I have 3 id in a string:
let $x="6,3,5"
I want to get all color information from tbl_color where color id are
6, 3 and 5.
I made this query, but does not work. What’s wrong with this?
$sql=" SELECT * FROM tbl_color WHERE color_id IN(".explode(',',$x).")
please suggest the right query
explode() takes a string and turns it into an array. You already have a string. All you need to do is change your statement and just include $x in your string. You don’t need to explode it.
UPDATE:
Per your comment, here is how I would do it:
HTH,
-aj