safest ways to connect to a database with PHP
If you are looking for the safe methods you actually need to fire proof your queries from injections. MySQL extension is going to be deprecated soon, it does not means its not safe now, its just the case that community dropped further development for the extension.
You can try both PDO and mysqli for your database queries, both are good.
Your choice should depends upon your database selection -
PDO supports around 12 different drivers, while MySQLi supports MySQL only.
List of PDO drivers available
CUBRID (PDO)
MS SQL Server (PDO)
Firebird/Interbase (PDO)
IBM (PDO)
Informix (PDO)
MySQL (PDO)
MS SQL Server (PDO)
Oracle (PDO)
ODBC and DB2 (PDO)
PostgreSQL (PDO)
SQLite (PDO)
4D (PDO)
Source - pdo-drivers-in-php
API support
PDO and MySQLi both offers object-oriented API, but MySQLi also offers a procedural API.
No comments:
Post a Comment