Jump to content


Photo

mysqli with PHP4.4?


  • Please log in to reply
1 reply to this topic

#1 bradbice

bradbice
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 17 March 2006 - 05:48 PM

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:

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

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?

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 17 March 2006 - 10:13 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users