Hi.
Does anyone know how to deal wiuth an ampersand in a query? I have a mysql database an d am using php to deal with it, and all is fine except some of my data has an & in it. For example, one manufacturere is call A&C. Whenever I try to use that variable to get results, I get nothing at all. Any ideas? Thanks.
$query = "select DISTINCT manufacturer from product_status ORDER BY manufacturer ASC";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
for ($i=-0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
$myvarm = $row["manufacturer"];
echo "<font face='Verdana' size='2'><a href='admin.php?sview=$myvarm'>$myvarm";
echo"</a>";
echo " | ";
}
$query = "SELECT product_id,manufacturer,product_name,product_price,product_sku,shipping,stock_status,stock_comment FROM product_status WHERE manufacturer='$sview' ORDER BY product_id ASC";
$result = mysql_query($query) or die("Query failed really bad");
print "<table border='1' cellpadding='3' cellspacing='0'>\n";
etc., etc.
I tried $myvarm = urlencode($myvarm); under the $myvarm = $row["manufacturer"]; line, and it works, but it also makes the results from query number one look odd with all of the encoding. Is there any other way around this? Thanks again in advance.