<?php
if ((!$year) && (!$make) && (!$model)) {
$maxRows_Recordset1 = 20;
} else {
$maxRows_Recordset1 = 20;
}
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$sqlorderby_Recordset1 = "make";
if (isset($sql_orderby)) {
$sqlorderby_Recordset1 = (get_magic_quotes_gpc()) ? $sql_orderby : addslashes($sql_orderby);
}
mysql_select_db($database_myConnection, $myConnection);
if ((!$year) && (!$make) && (!$model) && (!$certified)) {
$query_Recordset1 = sprintf("SELECT * FROM used_vehicle ORDER BY %s", $sqlorderby_Recordset1);
} else if ((!$make) && (!$model) && (!$certified)) {
$query_Recordset1 = sprintf("SELECT * FROM used_vehicle WHERE year = '$year' ORDER BY make,model,body,ext_color", $sqlorderby_Recordset1);
} else if (($year != "") && ($model != "") && (!$certified)) {
$query_Recordset1 = sprintf("SELECT * FROM used_vehicle WHERE year = '$year' OR make = '$make' ORDER BY make", $sqlorderby_Recordset1);
} else if ((!$year) && (!$make) && (!$certified)) {
$query_Recordset1 = sprintf("SELECT * FROM used_vehicle WHERE year = '$year' OR make = '$make' OR model = '$model' ORDER BY body,year,ext_color", $sqlorderby_Recordset1);
} else if ((!$year) && (!$make) && (!$model)) {
$query_Recordset1 = sprintf("SELECT * FROM used_vehicle WHERE certified = '1' ORDER BY web_price,make,model", $sqlorderby_Recordset1);
}
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $myConnection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
?>