What's distinction between mysql,mysqli and pdo ?
Which is the greatest suitable for use with PHP-MYSQL?

You will find (a lot more than) three popular uses of MySQL from PHP.

  1. The mysql functions are procedural and employ manual getting away.
  2. mysqli is really a alternative for that mysql functions, with object-oriented and procedural versions. It's support for prepared claims.
  3. PDO (PHP Data Objects) is really a general database abstraction layer with support for MySQL among a number of other databases. It offers prepared claims, and significant versatility in how information is came back.

I would suggest using PDO with prepared claims. It's a well-designed API and enables you to easier proceed to another database (including any that supports ODBC) if required.

Individuals are differents API to gain access to a MySQL after sales

  • the mysql may be the historic API
  • the mysqli is really a latest version from the historic API, it will perform better and also have a better group of function, also the API is object oriented
  • PDO_MySQL, may be the MySQL for PDO, PDO continues to be introduced in PHP, the project aims to create a common API for the databases access, so theoretically you need to have the ability to migrate between RDMS without altering any code(if you do not use specific RDBM function inside your queries), also object oriented

Therefore it depend what type of code your wish to produce, should you prefer object oriented layers or plain functions...

My advice could be

  1. PDO
  2. mysqli
  3. mysql

Also my feeling, the mysql API would most likely being erased later on releases of PHP

mysqli may be the enhanced version of mysql.

PDO extension defines a lightweight, consistent interface for being able to access databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions.

There's a table evaluating the three API features. Use Mysqli whenever you can out of the box the most recent released after PDO and it is and will also be better maintained later on.