You are here: [suspicious - maybe spam] Re: MYSQLI, Class not found? « PHP « IT news, forums, messages
[suspicious - maybe spam] Re: MYSQLI, Class not found?

Posted by Catalin Trifu on 06/21/05 03:25

Hi,

Is PHP compiled with mysqli support: http://ro.php.net/mysqli
Read the docs about what this extension requires.

Catalin


Esteamedpw@aol.com wrote:
>
> Hey guys,
>
> I'm doing a tutorial from a book (PHP and MySQL Web Development) and I'm
> having a problem... when I use the script they supply I get this error:
>
>
> Fatal error: Class 'mysqli' not found in
> C:\apachefriends\xampp\htdocs\results.php on line 29
>
> here is 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');
>
>
> //$db = mysql_connect('localhost', 'root', 'root'); // tried this way, no
> luck
> //mysql_select_db("bookorama", $db);
>
> 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();
>
> ?>
>
> </body>
> </html>
>
> ===================================================
>
> I updated PHP from 5.0.3 to 5.0.4 to see if it would help, no luck.
>
> Now I'm just completely lost.
>
> Thanks,
>
> Clint
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация