Possible Duplicate:
mysqli or PDO - what are the pros and cons?
I started a project about eight months ago. I have already gone far into the project. However, the project have been developed using the traditional mysql syntax. Until recently I started coming across PDO and MySQLi.
I have also read how the use of the traditional mysql
is being depreciated and may not work with further updates on the MySQL database. I am a bit confused. I do not know if I should choose between changing the traditional mysql
I have used to either PDO or MySQLi (if yesm, which is better, PDO or MySQLi and why?) or if I should continue with the traditional mysql
.
While switching to PDO is not that big of a deal and wouldn't take that long, with a one week deadline on an 8 month project I would have to advise against switching to PDO for the mean time.
You are going to have a fair bit of testing to make sure everything is working well, and since you only have a week left you probably have other small things you need to finish up first.
Save switching to PDO for after the launch and the next minor version upgrade so that you have more time for testing.
In the meantime I would suggest switching to mysqli since as another answer says, doing a strreplace on mysql_ to mysqli_ is easy
Change to PDO. The changes will be smaller then you might think (but don't underestimate it either, read the documentation).
PDO is better than mysqli because it enables you to easier change between MySQL and other database-types if needed later, there may be other reasons too, but this one should be enough.
PDO is common used with DAO where you don't care about such things as mysql or mysqli. Have a look at modern frameworks.
Further updates of PHP is not your business now. You use current possibilities and they work correctly, just fix version requirments in the technical project. Moving to mysqli or something like this to upgrade the application is the support service, not the development.
With such a short deadline MySQLi is the obvious choice: Anything that works with MySQL module will work with MySQLi without any changes - just update functions starting with mysql_ to mysqli_.
PDO is a whole different beast - it's an extra abstraction layer that makes switching to a different database easy and does a lot of db related stuff for you.
Also, this has been already answered multiple times PHP PDO and MySQLi