Jump to content

mysqli with PHP4.4?


bradbice

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?
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.