Is it possible to use both MySQLi and PDO?

送分小仙女□ 提交于 2020-01-05 17:57:15

问题


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



来源:https://stackoverflow.com/questions/28718684/is-it-possible-to-use-both-mysqli-and-pdo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!