Is this possible?
mysql_query("SELECT * FROM vehicle WHERE '$search'='$search'");
I know I am doing it wrong somehow, is this even possible to do. If so how could I do something like this.
I am making a search for an auto dealer and I need it to pull the variable from the URL (I already can do that) and turn it into $search to find everything under the searched category (i.e. cars) with the $search again as another variable. I think I am making this confusing. Here is my code that makes the links.
<p>• <a href="list.php?search=2-Door" class="dropitem">2 Door Coupe</a><br>
• <a href="list.php?search=Hatchback" class="dropitem">2 Door Hatchback</a><br>
• <a href="list.php?search=4-Door" class="dropitem">4 Door Sedan</a><br>
• <a href="list.php?search=Car" class="dropitem">All Cars</a></p>
Here is the code to try to break it all down and display it.
<? include('dbinfo.inc.php');
$search = $HTTP_GET_VARS['search'];
?>
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" background="images/shadowcar.jpg">
<tr>
<td height="475" width="100%" valign="center">
<table width="100%" height="231">
<tr>
<td><table width="100%" border="1">
<tr><td>Price</td><td>VIN</td><td>Type</td><td>Year</td><td>Make</td><td>Model</td><td>Color</td><td>Transmission</td>
<td>Miles</td><td>Engine</td><td>Driveshaft</td><td>Doors</td><td>Extras</td><td>Image Link</td></tr>
<?
$listquery = mysql_query("SELECT * FROM vehicle WHERE '$search'='$search'") or die(mysql_error());
while ($row = mysql_fetch_assoc($listquery)) {
$price = $row['price'];
$vin = $row['vin'];
$kind = $row['kind'];
$year = $row['year'];
$make = $row['make'];
$model = $row['model'];
$color = $row['color'];
$transmission = $row['transmission'];
$miles = $row['miles'];
$engine = $row['engine'];
$driveshaft = $row['driveshaft'];
$doors = $row['doors'];
$extras = $row['extras'];
$image = $row['image'];
echo"
<tr><td>$$price</td><td>$vin</td><td>$kind</td><td>$year</td><td>$make</td><td>$model</td><td>$color</td><td>$transmission</td>
<td>$miles</td><td>$engine</td><td>$driveshaft</td><td>$doors</td><td>$extras</td><td><a href='show.php?car=$vin'>Image</a></td></tr>
";
} ?>
</table></td>
</tr>
</table> </tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td height="50" colspan="2">
<div align="right">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="/images/bar3.gif" height="21">
</td>
</tr>
</table>
It needs to be able to decifer between cars, truck SUV, Van 2-Door, Hatckback, engine, etc etc. I know I can just include AND into my query to lower the return results. But I am have issues with making the proper query. Any help would be great. Thanks!