I'm having trouble with a FIND_IN_SET
query. I can get the basic query to work but when I replace the search terms with PHP variables it fails.
if ($_GET['picId']) {
$query_class = $_GET['query_class'];
$query_subclass = "picSearch";
$criteria = "(FIND_IN_SET (".$_GET['picId'].",pic_IDs))" ;
$criteria_value = ">0";
}
$tbl_name = "expo_data";
$result = mysql_query("SELECT * FROM $tbl_name WHERE $criteria $criteria_value");
If I use a hard coded query it works fine. say "look for all occurrences of a picture with id=3 in column pic_IDS"
$result = mysql_query("SELECT * FROM $tbl_name WHERE (FIND_IN_SET(3,pic_IDs))>0");
If I echo $criteria
and $criteria_value
the results "Look" OK.
So what am I doing wrong?