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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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)
回答2:
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