Re: MySQLI, Class not found

From: Date: Tue, 21 Jun 2005 09:17:03 +0000
Subject: Re: MySQLI, Class not found
Groups: php.general 
Request: Send a blank email to php-general+get-217283@lists.php.net to get a copy of this message
Well, I figured out that problem (I suppose) by upgrading to MySQL 5.0 and the error doesn't come up anymore... but now I get this error: Fatal error: Call to a member function free() on a non-object in C:\xampp\htdocs\results.php on line 60 Again, here's the code: ================================================== <?php // create short variable names $searchtype=$_POST['searchtype']; $searchtype=$_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); } $db = new mysqli('localhost', 'root', 'root', 'bookorama'); if(mysqli_connect_errno()) { echo 'Error: Could not connect to the Database. Please try again later.'; exit; } $query = "select * from books where ".$searchtype." like '%".$searchterm."%'"; $result = $db->query($query); $num_results = $result->num_rows; echo '<p>Number of books found: '.$num_results.'</p>'; for ($i=0; $i <$num_results; $i++) { $row = $result->fetch_assoc(); echo '<p><strong>'.($i+1).'. Title: '; echo htmlspecialchars(stripslashes($row['title'])); echo '</strong><br />Author: '; echo stripslashes($row['author']); echo '<br />ISBN: '; echo stripslashes($row['isbn']); echo '<br />Price: '; echo stripslashes($row['price']); echo '</p>'; } //$result->free(); $db->close(); ?> ================================================ Anymore help would be more than appreciated! I've spent hours trying to fix the first problem and about another hour trying to fix this one now... Google doesn't supply anything besides PHPNuke installation errors - which is not the case here. Thanks, Clint

« previous php.general (#217283) next »