Re: MySQLI, Class not found

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

 



    Could you make a var_export($result); before calling free() ?
    Normally the extension should work fine with MySQL 4.1.12.
    Does the phpinfo() say against which MySQL version it was compiled.
    I use mysqli on linux and have no problems with it.
    php5.1.0b1, apache 2.0.54, mysql 4.1.12, gentoo ck-sources-2.6.11 with nptl kernel

Catalin


Esteamedpw@xxxxxxx wrote:
> 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
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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