Please, I need help, I am trying to create a search on a website, the below error ( $numrows=mysql_num_rows($numresults); line 57) keep showing even after I have create the sql query in many forms, the error highlited in blue and the lne of the error in red on the php scrpt. Gab Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\mydatabase\search.php on line 57 Results Sorry, your search: "john" returned zero results Couldn't execute query <?php $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable $limit=10; if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } mysql_connect("localhost","root",""); //(host, username, password) mysql_select_db("mydatabase") or die("Unable to select database"); //select which database we're using $query = "select * from table where 1st_field like studentID='$studentsID','Name='$Name',address='$address',phone='$phone',sex='$sex',DOB='$DOB' \"%$trimmed%\" order by 1st_field"; $numresults=mysql_query($query2); $numrows=mysql_num_rows($numresults); This is the line 57 if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; } if (empty($s)) { $s=0; } $query = " limit $s,$limit"; $result = mysql_query($query2) or die("Couldn't execute query"); echo "<p>You searched for: "" . $var . ""</p>"; echo "Results"; $count = 1 + $s ; while ($row= mysql_fetch_array($result)) { $title = $row["1st_field"]; echo "$count.) $title" ; $count++ ; } $currPage = (($s/$limit) + 1); echo "<br />"; if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>  "; } $pages=intval($numrows/$limit); if ($numrows%$limit) { $pages++; } if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?> [Non-text portions of this message have been removed]