Why is this script showing the same record when I am specifying different ones through my search with my search script?
<-- My Search Request Script -->
<?php
echo "<form name=search action=search.php><select name=make>";
$connection = mysql_connect ('localhost', 'user', 'pass');
if ($connection == false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
}
$query = "select * from autos ORDER by make";
$result = mysql_db_query ("autos", $query);
if ($result){
$numOfRows = mysql_num_rows ($result);
for ($i = 0; $i < $numOfRows; $i++){
$make = mysql_result ($result, $i, "make");
echo "<option value=\"$make\">$make";
}
echo "</select><input type=submit value=\"GO\"></form>";
}
else{
echo mysql_errno().": ".mysql_error()."<BR>";
}
mysql_close ();
?>
The search script is below:
<?php
$connection = mysql_connect ('localhost', 'user', 'pass');
if ($connection == false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
}
$query = "select * from autos where make='$make'";
$result = mysql_db_query ("autos", $query);
if ($result){
$numOfRows = mysql_num_rows ($result);
for ($i = 0; $i < $numOfRows; $i++){
$category = mysql_result ($result, $i, "category");
$img_url = mysql_result ($result, $i, "img_url");
$year = mysql_result ($result, $i, "year");
$make = mysql_result ($result, $i, "make");
$price = mysql_result ($result, $i, "price");
$mileage = mysql_result ($result, $i, "mileage");
$comments = mysql_result ($result, $i, "comments");
$id = mysql_result ($result, $i, "id");
$sale_type = mysql_result ($result, $i, "sale_type");
$city = mysql_result ($result, $i, "city");
$province = mysql_result ($result, $i, "province");
$contact = mysql_result ($result, $i, "contact");
$telephone = mysql_result ($result, $i, "telephone");
$email = mysql_result ($result, $i, "email");
$offer = mysql_result ($result, $i, "offer");
echo "<table><tr><td><img src=\"http://localhost/western/$img_url\" width=300
align=left><font class=small>$year<br>$make<br>$mileage<br>OPTIONS:
$comments<br>$price<br>$contact<br>$telephone<br>[ <a href=\"java script:void
window.open('inquiry.php?id=$id', 'inquiry', 'width=450,height=350')\">send seller an
inquiry</a> ] </td></tr></table>";
}
}
else{
echo mysql_errno().": ".mysql_error()."<BR>";
}
?>
What am I doing wrong?