Canman2005 Posted April 13, 2006 Share Posted April 13, 2006 Hi allI have some id numbers stored in a sql database under a field called "idnums", for example, one of my rows stores id numbers in field "idnums" in the following format1,5,7,17each number is a id number in another table.I insert the id numbers from a multiple selection list on a form using the 'join' function.I then have a php query which looks like[code]$query=MYSQL_QUERY("SELECT * FROM order");[/code]I want to be able to select just the id numbers from the table "orders" that are stored in the "idnums" field, I thought I could do [code]$query=MYSQL_QUERY("SELECT * FROM order WHERE id = $idnums");[/code]but it doesnt seem to be able to do that, how could I get it to do this?Any help would be aceThanks in advanceEd Quote Link to comment Share on other sites More sharing options...
Honoré Posted April 13, 2006 Share Posted April 13, 2006 Try something like:[code]$query=MYSQL_QUERY("SELECT * FROM order WHERE id IN ( $idnums )");[/code] Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted April 13, 2006 Author Share Posted April 13, 2006 [!--quoteo(post=364483:date=Apr 13 2006, 06:05 PM:name=Honoré)--][div class=\'quotetop\']QUOTE(Honoré @ Apr 13 2006, 06:05 PM) [snapback]364483[/snapback][/div][div class=\'quotemain\'][!--quotec--]Try something like:[code]$query=MYSQL_QUERY("SELECT * FROM order WHERE id IN ( $idnums )");[/code][/quote]Thank you, worked great Quote Link to comment 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.