• support@answerspoint.com

Why shouldn't I use mysql_* functions in PHP?

1481

What are the technical reasons why I shouldn't use mysql_* functions? (e.g. mysql_query()mysql_connect() or mysql_real_escape_string())?

Why should I use something else even if they work on my site?

  • PHP

  • asked 8 years ago
  • B Butts

1Answer


0

The MySQL extension is:

  • Not under active development
  • Officially deprecated as of PHP 5.5.
  • Removed entirely as of PHP 7.0
  • Lacks an OO interface
  • Doesn't support:
    • Non-blocking, asynchronous queries
    • Prepared statements or parameterized queries
    • Stored procedures
    • Multiple Statements
    • Transactions
    • The "new" password authentication method (on by default in MySQL 5.6; required in 5.7)
    • All of the functionality in MySQL 5.1

Since it is deprecated, using it makes your code less future proof.

Lack of support for prepared statements is particularly important as they provide a clearer, less error prone method of escaping and quoting external data than manually escaping it with a separate function call.

  • answered 8 years ago
  • Gul Hafiz

Your Answer

    Facebook Share        
       
  • asked 8 years ago
  • viewed 1481 times
  • active 8 years ago

Best Rated Questions