Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4325334
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:15:10+00:00 2026-05-21T09:15:10+00:00

Why can’t i pull this field pID from the the database? I have the

  • 0

Why can’t i pull this field pID from the the database?

I have the following php:

<?php
// Get course information cID, prefix, code and dept info : name
$cID = filter_input(INPUT_GET, 'cID', FILTER_SANITIZE_NUMBER_INT);
if(!$cID) {
    echo "No cID specified.";
    exit;
}
require_once('inc/dbc1.php');
$pdo4 = new PDO('mysql:host=localhost;dbname=###', $username, $password);
$pdo4->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sth4 = $pdo4->prepare('
    SELECT fname, lname
    FROM Course Cou, Comment Comm, Professor P
    WHERE Cou.cID = ?
    AND P.pID = Comm.pID
    GROUP BY concat(fname, lname);
    ');
$sth4->execute(array(
    $cID
));
?>

HTML/PHP

<a href='prof.php?pID={$row['pID']}' title='Drexel Professor Comments for {$row['fname']} {$row['lname']}'>

img

The above is pulling the fname and lname fields, but the first call for pID is not being pulled.

  • If I add pID to the select statement,
    it gives me the ambiguous pID error

    .

Anyone??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T09:15:11+00:00Added an answer on May 21, 2026 at 9:15 am

    You need to add the field to the select statement, otherwise it won’t be part of the result set.

    If I add pID to the select statement, it gives me the ambiguous pID error

    Then make it unambiguous:

     SELECT fname, lname, P.pID
    

    should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I use the following across all browsers? <a href=# onclick=doSomething()>Click here.</a> Is this
Can anyone tell me what's wrong with this robots.txt? http://bizup.cloudapp.net/robots.txt The following is the
Does anyone know how can I replace this 2 symbol below from the string
Can we add multiple rows in the database table from one JSF page in
Can you tell me what is the difference between abstraction and information hiding in
Can I get a 'when to use' for these and others? <% %> <%#
I have a jquery bug and I've been looking for hours now, I can't
Can someone tell me what language(s) the following formula is formatted for? IF(($A) >
Can someone explain to me what this would do? Module Foo class Bar class_inheritable_accessor
Can anyone tell me whats wrong in this code? when i try this i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.