SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Location
    Sao Paulo, Brazil
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Are the mysql_* functions considered outdated? Do you use PDO in all your scripts?

    I don't see many advantages to switch to PDO because I'm sure I won't use another database anytime soon, and I'm used to a database class that uses the mysql functions. Is this considered an outdated style? Are you using only PDO?

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Prepared statements is a good enough reason for me.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Addict Mastodont's Avatar
    Join Date
    Mar 2007
    Location
    Czech Republic
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, mysql extension is dead. But mysqli is still fine.

  4. #4
    PHP/Rails Developer Czaries's Avatar
    Join Date
    May 2004
    Location
    Central USA
    Posts
    806
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should not be using database-specific functions, which includes the mysqli extension (specific to MySQL). The reason to use PDO is that it's database-agnostic. The interface and actual functions you use are exactly the same, no matter what database you're communicating with, and that's enough reason alone to use it.

  5. #5
    SitePoint Evangelist
    Join Date
    Mar 2006
    Location
    Sweden
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, that's one of the problems with PDO right now, that even if the database independence was the goal, it wasn't achieved all the way. That's why they're trying to get the ball going again and make PDO v2.

  6. #6
    SitePoint Member
    Join Date
    Dec 2008
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PDO looks like a lot of work, but because of prepared statements, it can actually result in much smaller codebase that has the same behavior as mysql_* based code. At least that is true when you structure your code appropriately. It's very well suited for compact ORM classes.

    However, if you don't want to use ORM, mysqli will probably be a better API for you. Can you give an example of your code that works with the database? It's difficult to discuss such things in abstract.
    Caffeine Web Framework - reinventing the wheel since 2004.
    MicroWSS - simple SOAP web services server in Java.

  7. #7
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mastodont View Post
    Yes, mysql extension is dead. But mysqli is still fine.
    The mysql extension is by no means dead -.- and the mysql_* functions are certainly not outdated. They are still very much in use and everyone should know how they work if only for future posterity.

    I tend towards PDO though I rarely have to used it.
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  8. #8
    SitePoint Addict Mastodont's Avatar
    Join Date
    Mar 2007
    Location
    Czech Republic
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've been thinking "dead" from next evolution point of view. See http://www.php.net/manual/en/mysqli.overview.php

  9. #9
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mastodont View Post
    I've been thinking "dead" from next evolution point of view. See http://www.php.net/manual/en/mysqli.overview.php
    They are still being used and maintained in applications on millions of websites as well as hundreds of open source and commercial applications among which are OScommerce and XCart last I checked.
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  10. #10
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    MySQL isn't outdated at all.

    However, when comparing features, I think all decent developers should at least know PDO.

    As soon as you play around with it you won't go back to MySQL.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


Bookmarks

Posting Permissions

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