I wish to know where and when we use PDO's apart from simple mysql_connect techniques?

Is PDO is faster ? do you know the advantages over other techniques?

  1. Security: Probably the most helpful factor with PDO would be the prepared claims. Together, writing code which may be SQL Injected is much more complicated. -)

  2. Errorhandling: However the errorhandling is a lot far better as possible change to Exceptions rather than lousy FATALs ERRORs and so forth.

  3. Extensibility: Using the mysql_ techniques you are strictly certain to mysql. Maybe sometime later on you need to use antoher database and also have to rewrite all of your connection and query giving code. If you are using MySQL specific queries this time doesn't have value for you as you've to rewrite much of your database code anyway.

The PDO introduction in the PHP documentation particulars point about this fundamental information. To some degree, PDO would be to PHP as JDBC would be to Java. Except, well, less than as nice.

Aside from the portability, mysqli gives you virtually just like PDO does (like prepared claims, transactions and so forth) with the exception that mysqli is a little faster than PDO.