#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    24
    Rep Power
    0

    Should I start using mySQLi


    Hi all.

    I'm going to start creating a simple website for my company where the end user logs in and enters data into some input boxes. Because I'm researching the login and password page I noticed some articles about PHP deprecating mySQL. I also posted a question about some of my code and they told me to stop using mySQL and switch to mySQLi.

    My web hosting company is GoDaddy and the PHP version is 5.3.

    What should I do? If I do it with mySQL will my website stop working whenever PHP decides to "turn off" mySQL?

    Thank you for your help and guidance.
  2. #2
  3. No Profile Picture
    Dazed&Confused
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2002
    Location
    Tempe, AZ
    Posts
    506
    Rep Power
    128
    The mysql_* functions have long gone unmaintained so there are questions surrounding their security, among other things. And yeah, when they're removed from PHP any scripts using them will cease to work.

    If you're writing a new application there's really no reason at all not to switch to mysqli_* or PDO. PDO seems to be the more popular option around here since it can be an interface to many different database engines, and the prepared statement syntax is a little nicer. mysqli is obviously going to be MySQL-specific and while it can do prepared statements, the syntax is less flexible.
    LinkedIn: Dave Mittner
  4. #3
  5. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    The mysql extension is officially deprecated as of PHP 5.5, but it is still being maintained. The implementation of the mysql_* functions themselves are not insecure, they are just difficult to use securely and lack support for a significant number of features. When the extension is removed (which will happen eventually), any applications relying on it will cease to function and most will probably require a substantial amount of effort to fix. There is absolutely no reason to build a new application using the mysql extension; I recommend the PDO extension instead.

    As far as the mysql extension itself goes (for people already using it who are wondering), it should continue to be maintained until at least July 2014, and probably into 2015. Because the extension is not deprecated in 5.4, maintenance releases for it should continue until at least the EOL date for 5.4 (which isn't set yet). Given the widespread use of the extension, I would not actually be surprised to see continued maintenance releases for it even after 5.4 reaches EOL.

    As far as removal from the language, I would guess that will happen in 5 - 10 years. register globals and magic quotes were both removed after having been officially deprecated for about 2 years, but both had been unofficially deprecated for about 10 years. The mysql extension has already been unofficially deprecated for a couple of years as well because many people knew it would be deprecated soon. I would not be surprised to see the extension officially removed as of PHP 6.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    24
    Rep Power
    0
    Thank you to the both of you for your help. I will use PDO instead of mySQLi.

IMN logo majestic logo threadwatch logo seochat tools logo