Jump to content

Archived

This topic is now archived and is closed to further replies.

bradbice

mysqli with PHP4.4?

Recommended Posts

I am using an example from the "PHP and MySQL Web Development" book by Welling and Thompson, and it utlizes the mysqli connection. Anyways, here's my line of code and the error it produces:

[code]
function db_connect()
{
$handle = new mysqli('localhost', 'user, 'pass', 'db');
   if (!$handle)
   {
     return false;
   }
   return $handle;
}
[/code]

and the error:

Fatal error: Cannot instantiate non-existent class: mysqli in d:\inetpub\technitrolinc\cms\db_fns.php on line 11

I am using php 4.4.1 on a shared host.

Is there any way, if the above can't work with that version, that I can get this to work without using mysqli?

Share this post


Link to post
Share on other sites
mysqli support is for PHP5 and upwards. It is not available to PHP4.x versions.

If you wish to use the mysqli functions see if your host will upgrade the current php version to php5 and see if they can compile php with mysqli support. Or just install a local server on your computer easy to do and allows you to learn php offline! saves you time but not uploading files to your host all the time instead you run them from the comfort of your own computer.

Look into pakages like wamp5 or XAMPP, or install Apache, PHP5 and MySQL on your computer manually - your book may show you haw to install these on your computer. All the packages mentioned above are free download and use, not costs involved

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.