& in mysql_query?
Posted on 2014-09-22
I have this query:
SELECT * from subcategory where prim = 'Waterworks and Corrosion' and category = 'Chlorine & Water Testing' order by so
When I run this "manually" against the database, it returns, correctly, 4 rows.
When I do the identical query in php, it returns zero rows. The php code is:
$pqrysc = "SELECT * from subcategory where prim = '" . $prd['pdesc'] . "' and category = '" . $cat . "' order by so";
echo $pqrysc . "<br>";
$pressc = mysql_query ($pqrysc, $Link);
$npsc = mysql_num_rows($pressc);
echo "num subcats = " . $npsc . "<br>";
the echo num subcats equals 0.
Does the & in the query cause an issue with mysql_query?
There are hundreds of other cases where there is no & in the category where the mysql_query returns correctly.
I am aware that is code is not the latest correct interface between php & MySQL