PHP PDO vs normal mysql_connect

前端 未结 12 976
盖世英雄少女心
盖世英雄少女心 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:41

    Some Advantages of PDO:

    1. Can Access multiple database.
    2. Provided many database driver to connect with different different database.
    3. When you switch from one database to another database, you need not to write all the code to connect with new database, just change the connection string and some query which are required for new database.
    4. It provides prepare statement which is a kind of template of query which compiled only once and can be executed as many times as you want, by just changing the attributes which is called place-holder.
    5. Easy and efficient General Operation like- Insert, update...etc.

提交回复
热议问题