View Full Version : Mysql to Pdo conversion?

10-18-2012, 11:34 PM

would this be easy to do? where would i start?

10-19-2012, 12:08 AM
If you currently have a centralized control, then yes it'd be quite easy as its only a few functions or classes to change. If you have mysql_* functions all over the place, then it's pretty much an overhaul.
First thing to do is make sure you have PDO and the available drivers. You'll know as soon as you call new PDO and give it the mysql drivers.
Beyond that, the world is your oyster. You need to change it all so you can start where you want; partial PDO isn't compatible with partial mysql_*, so its all or none.

10-19-2012, 06:52 AM

would this be easy to do? where would i start?

For the research, there's this article I saw some time back: PDO - MySQLi Comparison (http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/). It gives the feeling of a smooth transition from mysql to PDO. It's a solid first step.
It compares MySQLi and PDO. MySQLi is very similar in all aspects to the original mysql db driver, although of course faster and with many other enhancements. So you'll have no problems at all following the MySQLi code.

You could later go to this one: PDO basics (http://net.tutsplus.com/tutorials/php/php-database-access-are-you-doing-it-correctly/)