Is it possible to use both MySQLi and PDO?

2019-08-12 22:27发布

Is it possible to use both MySQLi and PDO ? For example, to insert data using MySQLi and then select and work with it using PDO in other part of the project? I have a lot of insert/update code in MySQLi, but decided to switch to PDO?

标签: php pdo mysqli
2条回答
倾城 Initia
2楼-- · 2019-08-12 22:48

it is, you just need to configure the connection for both.

You're much better off converting it all to PDO though. It will save time in the long run fixing all the security vulnerabilities in Mysqli

查看更多
地球回转人心会变
3楼-- · 2019-08-12 22:54

Yes, it's possible. But keep in mind that you'd have two completely separated connections to the MySQL server in any case. The mysqli_* and PDO_MySQL extensions cannot (currently) share a single connection even though they use the same transport driver (MySQLnd)

查看更多
登录 后发表回答