PHP PDO vs normal mysql_connect

前端 未结 12 980
盖世英雄少女心
盖世英雄少女心 2020-11-27 12:15

Should I use php PDO or normal mysql_connect to execute database queries in PHP?

Which one is faster?

One of the big benefits of PDO is that the interface is

12条回答
  •  难免孤独
    2020-11-27 12:44

    PDO is a bit slower than the mysql_* But it has great portability. PDO provides single interface across multiple databases. That means you can use multiple DB without using mysql_query for mysql, mssql_query for MS sql etc. Just use something like $db->query("INSERT INTO...") always. No matter what DB driver you are using.

    So, for larger or portable project PDO is preferable. Even zend framework use PDO.

提交回复
热议问题