Re: MySQLI, Class not found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux