Jump to content

[SOLVED] Column 'ID' in where clause is ambiguous


Recommended Posts

Your not telling the database which table the id column your looking at is in.

 

Wow screw that im lost

 

 

Can you help me on this part ima going to redo it kk? :]

 

$DB->query("SELECT id, title, text, description,starter,start_date,views,editor,edit_date from ibf_faq WHERE ID='$id'");

 

i need to inner join my ibf_members with starter and editor same id as from my ibf_members which is id also. lol

 

I want to join

Okay put it this way

ibf_faq has a field called ID

ibf_members has a field called ID

 

and your saying

WHERE ID='$id'

What ID are you trying to use ?

the ID from ibf_faq or ibf_members?

 

I'll guess and say ibf_faq, so change

WHERE ID='$id'

to

WHERE ibf_faq.ID='$id'

Okay put it this way

ibf_faq has a field called ID

ibf_members has a field called ID

 

and your saying

WHERE ID='$id'

What ID are you trying to use ?

the ID from ibf_faq or ibf_members?

 

I'll guess and say ibf_faq, so change

WHERE ID='$id'

to

WHERE ibf_faq.ID='$id'

 

Thanks for your reply

 

after changed that, i geT:

 

mySQL error: Unknown column 'faq.ID' in 'where clause

The get has nothing to do with the field names

if your passing ID via get then i would guess that your code would look like this

   $id = $ibforums->input['ID']; //updated
       

       $DB->query("SELECT cl.*, t.desktop AS to_desktop from
      ibf_faq AS cl
      INNER JOIN ibf_members AS t ON t.name = cl.id
      WHERE cl.id='$id'"); //updated

The get has nothing to do with the field names

if your passing ID via get then i would guess that your code would look like this

   $id = $ibforums->input['ID']; //updated
       

       $DB->query("SELECT cl.*, t.desktop AS to_desktop from
      ibf_faq AS cl
      INNER JOIN ibf_members AS t ON t.name = cl.id
      WHERE cl.id='$id'"); //updated

 

Yea but no results will SHOW Up.

SELECT cl.*, t.desktop AS to_desktop from ibf_faq AS cl INNER JOIN ibf_members AS t ON t.name = cl.id WHERE cl.id='2'

 

WHERE cl.id='2'

 

I cant explain but i'l show u picture.

 

 

10ht0lw.jpg

 

so how is where cl.id='2' that's not catching my id so no results will show up..

so why change cl.id ??

 

 

Hey man but please could u stick with me and help me fiqure this out ^^

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.