Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,341
    Thanks
    260
    Thanked 32 Times in 31 Posts

    Conversion input - mysql - PDO

    Hi,

    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?


    Thanks...
    Last edited by durangod; 05-12-2013 at 03:49 AM.

  • #2
    New Coder
    Join Date
    Dec 2011
    Posts
    63
    Thanks
    4
    Thanked 10 Times in 10 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 05:01 AM.

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,772
    Thanks
    23
    Thanked 550 Times in 549 Posts
    You might want to look at mysqli also. Easier to convert to.

  • #4
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,341
    Thanks
    260
    Thanked 32 Times in 31 Posts
    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..

  • #5
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,961
    Thanks
    2
    Thanked 305 Times in 297 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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •