Anyway to get around using "&" in a query? When I try this query, an undefined variable error is returned.
"SELECT DISTINCT model FROM carval_data WHERE make = 'A&W' ORDER BY CAST(model AS CHAR)"
EDIT: Just figured out it's not an issue with MySQL, but rather PHP. Any solutions?
Second EDIT: This is what's returned
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/var/www/html/carval.php</b> on line <b>33</b><br /><br />
<b>Notice</b>: Undefined variable: query in <b>/var/www/html/carval.php</b> on line <b>41</b><br /><br />
<b>Warning</b>: mysqli_query(): Empty query in <b>/var/www/html/carval.php</b> on line <b>41</b><br /><br />
<b>Warning</b>: mysqli_error() expects exactly 1 parameter, 0 given in <b>/var/www/html/carval.php</b> on line <b>44</b><br />
Here's the lines 32-50
foreach($body as $key => $jsons) {
foreach($jsons as $key => $value) {
if($key == 'query'){
$query = $value;
}
}
}
mysqli_set_charset($link, 'utf8');
$result = mysqli_query($link, $query);
if($result === FALSE){
die(mysqli_error());
}
if (!$query) {
echo 'MySQL Error: ' . mysqli_error();
exit;
}