Actually the problem is you are trying to assign two entirely separate queries to the same variable, and ending up overwriting the results of the first with the results of the second.
Try this:
PHP Code:
settype($carid,"integer");
settype($author,"string");
// determine what's got a value and what doesn't, and set the WHERE clause accordingly
if ($carid!="" && $author!=""){
$where="WHERE CarID=$carid AND AuthorA='$author'";
} elseif ($carid=="" && $author!="") {
$where="WHERE AuthorA='$author'";
} elseif ($carid!="" && $author=="") {
$where="WHERE CarID=$carid";
} else {
// neither $carid nor $author is set
$where="";
}
// run the queries
$CarList = mysql_query("SELECT * FROM cars $where ORDER BY $sortby $sortbyorder LIMIT $startpoint,5");
$CarListNext = mysql_query("SELECT * FROM cars $where ORDER BY $sortby $sortbyorder LIMIT $startpintNext,5");
$totalNext = mysql_num_rows($CarListNext);
Bookmarks