MySQL is an extremely powerful database and it comes with many flavours and options… It can thus, be hard understanding the absolute best approach based on your implementation decisions. What worked for MySQL does not work the same for MySQLi. Equally, MySQLi is quite different from MySQL PDO.
I suggest reading “PDO vs MySQLi – which should you use” for more information on the differences between MySQLi and PDO. My preference is PDO, but you may decide MySQLi is better for your situation.
Some differences include:
- MySQLi only supports MySQL Databases whilst PDO acts as an abstraction layer, thus supporting numerous different database drivers.
- PDO supports named parameters, whilst MySQLi doesn’t.
Most critically – Both of them support SQL injection security, but only if the developer uses them in the way they were intended.
It is thus good to have one single complete reference for your choice. I prefer PDO, so suggest reading “(The only proper) PDO tutorial” to ensure that you use the correct implementation intended for PDO.
Perhaps you know of a good complete reference for MySQLi? Let me know and I will add it here.