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
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Why is mysql_query getting deprecated?

    Google can't seem to answer this one.....

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    The entire mysql library is obsolescent. I'm surprised they kept it around this long.
    The mysql library does not support many of the new functions available in the mysql dbms such as prepared statements. This functionality was added into the mysqli library which is simply the improved version. It also fixes little annoyances that the old mysql carried around such as improper return results and the auto global of the established connection.
    So in short, good riddance; I for one won't shed a tear when its finally removed.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,593
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Getting rid of it will plug some of the security holes associated with its use.

    Rewriting your code to make use of the new code that mysqli_ and pdo support that mysql_ didn't will get rig of additional security holes.

    Also the mysql_ interface was procedural only whereas PHP is an object oriented language and the other two interfaces can be used via objects.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,368
    Thanks
    262
    Thanked 32 Times in 31 Posts
    What surprises me is that it seems that until recently when we starting talking about this on this forum (and when Fou-Lu put this on his signature) and i have shared some of this on my other forum posts, on personal blogs, and also on other forums. Many people seemed to have no clue this was happening and now they are freaking out.

    I have seen questions like, what about wordpress and what about this and that, thinking that they will be left hanging.

    PHP 5.5 is just now in Alpha, my thought is that i will not be released for awhile, i am thinking inside of 2 years. That gives me time to start this and do this at my own pace rather than crunch at the end.

    And 2 years goes by fast in this industry, by the time you convert your scripts, update your downloads and websites and forums and in the mean time still do what you do to make a living, 2 years will be here quick. That is the reason i am starting now.

    And actually its not that bad of a conversion once you get the hang of it, i just wrapped up my second script conversion and a couple things i need to do but it was not that bad. But i still have my huge script to go and so we will see how positive i am then...lol

    Just dont panic people is all im saying, the major scripts out there im sure are already planning for this and the world is not going to end because mysql library does...

    And i totally agree with what was said above, this is a perfect opportunity to improve your scripts above and beyond the conversion it self.

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by felgall View Post
    Also the mysql_ interface was procedural only whereas PHP is an object oriented language and the other two interfaces can be used via objects.
    This is incorrect; PHP is natively a procedural language. OO was fit together in 4. . .2.0 I think it was. And by "fit", I mean they used a sledgehammer to force them puzzle pieces together
    5.0 took a major overhaul to the engine to allow (more) correct OO concepts. It is still procedural though, but the OO side of it is getting a lot better.

    Quote Originally Posted by durangod View Post
    What surprises me is that it seems that until recently when we starting talking about this on this forum (and when Fou-Lu put this on his signature) and i have shared some of this on my other forum posts, on personal blogs, and also on other forums. Many people seemed to have no clue this was happening and now they are freaking out.

    I have seen questions like, what about wordpress and what about this and that, thinking that they will be left hanging.

    PHP 5.5 is just now in Alpha, my thought is that i will not be released for awhile, i am thinking inside of 2 years. That gives me time to start this and do this at my own pace rather than crunch at the end.

    And 2 years goes by fast in this industry, by the time you convert your scripts, update your downloads and websites and forums and in the mean time still do what you do to make a living, 2 years will be here quick. That is the reason i am starting now.

    And actually its not that bad of a conversion once you get the hang of it, i just wrapped up my second script conversion and a couple things i need to do but it was not that bad. But i still have my huge script to go and so we will see how positive i am then...lol

    Just dont panic people is all im saying, the major scripts out there im sure are already planning for this and the world is not going to end because mysql library does...

    And i totally agree with what was said above, this is a perfect opportunity to improve your scripts above and beyond the conversion it self.
    People shouldn't panic, not yet. MySQL isn't a small part of PHP, its a huge part. I'd expect that we'll go until *at least* 5.8 before it's actually removed, and IMO not until 6.0.
    Compare it to something like magic_quotes or register_globals. register_globals was officially deprecated in 5.3 and removed in 5.4. That was a short turn around. But register_globals by default has been disabled since 4.2, so the reliance on it should have been minimal to start with. magic_quotes was simply a bad idea to start with, and should have been dealt with years ago. Unlike these two examples, thousands upon thousands of scripts rely on the mysql library, so they won't be so quick to yank it (even if it was soft deprecated since 5.0).
    5.5.0 won't take long to roll out; I'd expect within the next few months. But I figure there's at least 2 years before you need to actually worry about not having mysql library available.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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