Vincent you are right about the predefined variables. However, I did not mention that my search also requires text input. That is my fault I was too vague. This is a small database that will never have more than 100 rows/cars in it at a time. I greatly appreciate all of the good advice and help you people offered and for now I ended up with this code and it works fine but I will keep trying to use a variation of Vincent's code because it makes more sense to me. It will take me a few days to figure out though as I am very new to php.
include ("config.inc.php");
if (!$order) {
$result = mysql_query("SELECT FROM new WHERE Body_style like '%$Body_style%' and Make like '%$Make%' and Category like '%$Category%' and Model like '%$Model%' and Year like '%$Year%' Order by Birthstamp DESC",$conn);
} else {
$result = mysql_query("SELECT FROM new WHERE Body_style like '%$Body_style%' and Make like '%$Make%' and Category like '%$Category%' and Model like '%$Model%' and Year like '%$Year%' Order by $order $sort",$conn);
}
$numrows=mysql_num_rows($result);
if ($myrow = mysql_fetch_array($result)) {
if (empty($order)) { $order=Birthstamp; }
if (empty($sort)) { $sort=DESC; }
if ($sort != "ASC")
$stk = "<a href=\"ssresults.php?sort=ASC&order=Stock_no&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Stock No.</b></font></a>";
if ($sort != "DESC")
$stk = "<a href=\"ssresults.php?sort=DESC&order=Stock_no&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Stock No.</b></font></a>";
if ($sort != "ASC")
$yr = "<a href=\"ssresults.php?sort=ASC&order=Year&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Year</b></font></a>";
if ($sort != "DESC")
$yr = "<a href=\"ssresults.php?sort=DESC&order=Year&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Year</b></font></a>";
if ($sort != "ASC")
$mk = "<a href=\"ssresults.php?sort=ASC&order=Make&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Brand</b></font></a>";
if ($sort != "DESC")
$mk = "<a href=\"ssresults.php?sort=DESC&order=Make&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Brand</b></font></a>";
if ($sort != "ASC")
$md = "<a href=\"ssresults.php?sort=ASC&order=Model&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Model</b></font></a>";
if ($sort != "DESC")
$md = "<a href=\"ssresults.php?sort=DESC&order=Model&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Model</b></font></a>";
if ($sort != "ASC")
$prc = "<a href=\"ssresults.php?sort=ASC&order=Price&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Price Range</b></font></a>";
if ($sort != "DESC")
$prc = "<a href=\"ssresults.php?sort=DESC&order=Price&Category=$Category\"><FONT SIZE=1 FACE=Verdana COLOR=000066><b>Price Range</b></font></a>";
I guess cut n paste can only get me so far now it is time to learn something.