Gayner Posted September 1, 2009 Share Posted September 1, 2009 $id = $ibforums->input['HID']; $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 ID='$id'"); Any idea? im lost.. Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/ Share on other sites More sharing options...
trq Posted September 1, 2009 Share Posted September 1, 2009 Your not telling the database which table the id column your looking at is in. Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910095 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910101 Share on other sites More sharing options...
MadTechie Posted September 1, 2009 Share Posted September 1, 2009 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' Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910105 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910106 Share on other sites More sharing options...
MadTechie Posted September 1, 2009 Share Posted September 1, 2009 (I just noticed the as cl) try WHERE cl.id='$id' Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910113 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 Thanks again for your reply but unfortunately.. i need that id and cant change cause it's a GET input.. like at my url it sys ID=5 so if i use cl.id then not gonna work.. lol Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910116 Share on other sites More sharing options...
MadTechie Posted September 1, 2009 Share Posted September 1, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910129 Share on other sites More sharing options...
Gayner Posted September 1, 2009 Author Share Posted September 1, 2009 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. 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 ^^ Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910134 Share on other sites More sharing options...
MadTechie Posted September 1, 2009 Share Posted September 1, 2009 Sorry it was 7am and i had no sleep, i assume the problem was t.name = cl.id Quote Link to comment https://forums.phpfreaks.com/topic/172659-solved-column-id-in-where-clause-is-ambiguous/#findComment-910235 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.