Everything in my code works but $num_results... Book-O-Rama Search Results Book-O-Rama Search Results \[code\] //create short variable names $searchtype=$_POST['searchtype']; $searchterm=$_POST['searchterm']; $searchterm=trim($searchterm); if (!$searchtype || !$searchterm) { echo 'You have not entered search details. Please go back and try again.'; exit; } if (!get_magic_quotes_gpc()) { $searchtype = addslashes($searchtype); $searchterm = addslashes($searchterm); } include "../common/inc/db_connect_books.php"; //$db = new mysqli_connect('localhost', 'root', '', 'books'); $sql = "SELECT * FROM books WHERE ".$searchtype." LIKE '%".$searchterm."%'" or die(mysql_error()); $result = $dbh->query($sql); $num_results = $result->num_rows; echo '<p>Number of books found: '.$num_results.'</p>'; foreach ($result as $row) { echo '<p><b>'.($i+1).'. Title: '; echo htmlspecialchars(stripslashes($row['title'])); echo '</b><br>Author: '; echo stripslashes($row['authors']); echo '<br>ISBN: '; echo stripslashes($row['isbn']); echo '<br>Price: '; echo stripslashes($row['price']); echo '</p>'; $result->free(); $dbh->close(); }?>\[/code\]PLease help