Error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\webareas\ie803\projectx\search.php on line 306
My php code is as follows:
<?php
$car = mysql_real_escape_string($_REQUEST['car']);
$model = mysql_real_escape_string($_REQUEST['model']);
$type = mysql_real_escape_string($_REQUEST['type']);
$colour = mysql_real_escape_string($_REQUEST['colour']);
$year = mysql_real_escape_string($_REQUEST['year']);
$price = mysql_real_escape_string($_REQUEST['price']);
$con = mysql_connect("--","---","---");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('-----', $con);
$sql = "SELECT * FROM Cars WHERE Make ='$car', Model ='$model', Type ='$type', Colour = '$colour', Year = '$year', Price = '$price'";
$result=mysql_query($sql, $con);
{
while($info = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $info['Make']. "</td>";
echo "<td>" . $info['Model']. "</td>";
echo "<td>" . $info['Type']. "</td>";
echo "<td>" . $info['Colour']. "</td>";
echo "<td>" . $info['Year']. "</td>";
echo "<td>" . $info['Price']. "</td>";
echo "<br/><br/><td>" . '<hr>' . "</td>";
}
}
echo "</tr>";
echo "</table>";
?>
line 306 is the while statement. I keep on getting errors after each change I make.