asmith Posted December 11, 2007 Share Posted December 11, 2007 hey guys ! i have an array like : $a = array( "1" ,"5" , "8" ,"12"); and a table in mysql which a lot of columns , one of the columns is "id" which is int. table like this : id aa bb cc dd 1 12 45 454 45 2 34 34 76 45 . . . my question is how can i show a list of this table rows which the id is values in my array ? then again i mean if i want to show my mysql table in a html table exactlly like above, but only showing the rows which is in my array. thanks Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 11, 2007 Share Posted December 11, 2007 something like this should work on the sql part $a = array( "1" ,"5" , "8" ,"12"); $sql = "select * from table where id in (".implode(",",$a).")"; then you can use the mysql functions to fetch the data and display it accordingly Quote Link to comment Share on other sites More sharing options...
asmith Posted December 11, 2007 Author Share Posted December 11, 2007 whoa man !! i was going to code 5 or 6 line about it ! you taught me a new line in mysql too !!! thanks a bunch ! again you ( i have 2 big question waiting ! big question for me of course , don't know when to ask ! lol ) 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.