php-pdoConnect to MariaDB using PHP PDO
Since MariaDB is fully compatible with Mysql, using it with PDO is the same as Mysql.
try {
  $pdo = new PDO('mysql:host=localhost;dbname=test', 'user', 'pwd');
} catch ( PDOException $e ) {
  die($e->getMessage());
}ctrl + c| $pdoPDO connection object | new PDOcreate new PDO connection | 
| PDOException $eexception will be thrown if connection failed | mysql:connect to MariaDB using Mysql protocol | 
More of Php Pdo
- How to install PHP PDO for Mysql in Ubuntu 22.04
- Fetch single row with PHP PDO
- Bind current datetime with PHP PDO
- Get current database name with PHP PDO
- How to get results after PHP PDO statement execute()
- Get affected rows with PHP PDO
- Set charset in PHP PDO
- Get JSON from table with PHP PDO
- Set execution timeout with PHP PDO
See more codes...