Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
Thread: Conversion input - mysql - PDO
05-12-2013, 04:26 AM #1
Conversion input - mysql - PDO
I posted this here because i feel its more about the interface php to PDO type of question..
I may have to convert one of my sites over from mysql to PDO... I know squat about PDO but it seems to be popular.
What i dont want to happen is to convert to PDO and then have the same thing happen that is happening to the mysql library right now and then have to convert all over again.
For those that know both mysql and PDO i wanted to get your input. Is this going to be a miserable learning curve or is it quite graceful?
Is PDO a good choice?
Last edited by durangod; 05-12-2013 at 04:49 AM.
05-12-2013, 05:58 AM #2
- Join Date
- Dec 2011
- Thanked 19 Times in 19 Posts
Most people lean towards using PDO because it offers better flexibility when it comes having the flexibility of using different database over mysqli (obviously) and the prepared statements can be named (:username for example) making it a little more easier to follow code wise.
Last edited by Strider64; 05-12-2013 at 06:01 AM.
05-12-2013, 06:07 PM #3
- Join Date
- Jan 2011
- Thanked 667 Times in 666 Posts
You might want to look at mysqli also. Easier to convert to.
05-12-2013, 06:30 PM #4
Yeah thanks for the reply, i have already converted several of my scripts to MySQLi library. But this new script is already on PDO which will save me from any conversion.
The issue is that it is a 4000 file script that needs the conversion and it was written for php4 way back when. I have updated it along the way but its getting old and tired ya know.. And it has query's in just about every file. Now days when i do somthing i just us a sql class so its alot more concentrated location wise with all the query's in one or two places but this one is going to be a nightmare regardless.
So the only script i found that was similar that was not mysql is this one im converting to which is PDO..
05-12-2013, 06:47 PM #5
- Join Date
- Oct 2006
- Denver, Colorado USA
- Thanked 339 Times in 331 Posts
An old script with 4000 files should be completely rewritten to actually use the server-side scripting language to do the work in one or a few files, rather than spreading code/content out in file after file after file.
You can of course write your own database wrapper functions/class that emulate the mysql functions being used and then basically (in most cases) do a global search/replace throughout the code to change the mysql_ function call name to the corresponding function/class method that you wrote.
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.