mysql vs mysqli, how to convert

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
batfastad
Forum Contributor
Posts: 433
Joined: Tue Mar 30, 2004 4:24 am
Location: London, UK

mysql vs mysqli, how to convert

Post by batfastad »

Hi everyone

I'm currently in the closing stages of the development of our small business intranet database system, using PHP and MySQL.
It's a beast, and is a huge improvement over our current FileMaker system. Even though in the scheme of things it's very small-scale: 40,000 company records; 60,000 contacts; 20,000 bookings/invoices... a total database size of about 30MB.

I've known about the 2 different mysql modules for PHP since I first installed Apache, PHP and MySQL and got them all talking to each other.
However I understand it really is recommended to use mysqli rather than mysql these days. Is that correct?

How would I go about converting my solution to MySQLi?
Is it just a case of replacing the functions with an equivalent mysqli_ function?

Luckily I have custom functions which act as wrappers for things like connecting to MySQL and performing a query, so I should only need to update those custom functions.
Or does using MySQLi involve a bit more than that?
From looking at the documentation on php.net it appears MySQLi takes the form of a class instead, and that could create extra work to transform the structure of many of my scripts... but it would be better to do that work now, than to come back to it in 18 months or so.

So, what's the deal?
I have the mysqli module enabled and showing in my phpinfo, and I think that's all the server config that needs to be done.

Thanks, B
Post Reply