So, I want to query my audio database and find all the audio files that contain a specific foreign key. However, I have a list of foreign keys that I want the query to search for.
I wanted to use a statement like this:
// list of foreign keys
$list = array('123','456',789');
// make $list a string
$newlist = implode(",",$list);
$q = sprintf("SELECT * from TableName where ColumnName IN(%s)", $newlist); Keep in mind, the explode function didn't add single qoutes to each element.
I don't seem to be getting the results I want as the IN clause is a bit tempermental.
Anybody have a workaround for dynamically creating lists for the IN clause? REMEMBER... IN CLAUSE LIKES QUOTED STRINGS.
thanks