Jump to content

MySQL or MySQLi


phppup

Recommended Posts

MySQL was removed from PHP.

 

Your choices are either Mysqli or PDO with the MySQL driver.

 

The consensus opinion of the vast majority of our staff and experienced php developers, is that PDO is easier to work with and better designed.

 

There is a complete and highly opinionated manual for using PDO here: https://phpdelusions.net/pdo

 

If you peruse that site, you'll also find a manual for using mysqli: https://phpdelusions.net/mysqli

 

I don't remember the exact location but there are places where there's some comparison between the two, particularly in support of binding parameters with a 'WHERE IN' queries.

 

In both cases, the common practice of creating SQL strings using PHP interpolation and user input is something that you no longer will want or need to do.

Link to comment
Share on other sites

In my opinion the switch is not necessarily painful, but it depends on the size and scope of the original code. If you have lots and lots of existing mysql_ queries all over the place, you have to go through them, and while cut and dried, it still might take a while.

 

If you perhaps have a database wrapper class, things could be a lot easier.

 

Either way, once you have the jist of the differences, it's not complicated, but perhaps time consuming. At that point it also might be work retrofitting in a database wrapper like Doctrine2, and converting everything to DBAL calls.

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.