Different introductions of mysql mysqli and PDO

  • 2020-05-24 05:15:11
  • OfStack

Normal mysql connections will definitely be discarded because the problem of sql injection is prevented every time and is relatively slow

mysqli is an optimization based on ordinary mysql. To be honest, it is very successful. The pretreatment method completely solves the problem of sql injection
But the only downside of 1 is that it only supports mysql databases and of course if you're not working with other databases or of course it's the best option
PDO is one of the newest connectivity options available and most databases have also addressed the sql injection but there are some drawbacks that it only supports php5 + versions but I heard that only this kind of connectivity will be available in the future php6

PDO unifies all database abstraction layer object interfaces, mysqli unifies only 1mysql

In short, PDO allows the same code to operate on different databases, such as when you migrate from mysql to mssql, with little or no program change
mysqli simply understands encapsulation without mysql

In the case of high load.PDO opens a long connection to get a relatively stable load "value". But it's not the most efficient.
mysql fastest. mysqli secondly. It's just that mysql and mysqli are at high concurrency and high system load. The load is also considerable. PDO doesn't.

Related articles: