1. Go to this page and download the library: Download mattbit/mysql-compat library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mattbit / mysql-compat example snippets
use Mattbit\MysqlCompat\Mysql;
Mysql::connect('host', 'user', 'password');
Mysql::selectDb('my_db');
$result = Mysql::query('SELECT * FROM my_table');
$row = Mysql::fetchArray($result);
use Mattbit\MysqlCompat\Mysql;
$manager = Mysql::getManager();
// Create a connection by specifying a custom DSN.
$connection = $manager->connect('mysql:dbname=mydatabase;host=myhost', 'user', 'pass');
// You can access the underlying PDO object
$pdo = $connection->getPdo();
// The rest of the code will use the last connection registered in the manager
$res = Mysql::query('SELECT * FROM my_table');
// But you can specify explicitly a connection as well
$res = Mysql::query('SELECT * FROM my_table', $connection);
$manager = Mysql::getManager();
$manager->connect('mysql:dbname=database;host=hostname;charset=customCharset', 'user', 'password');
// This will automatically use the connection above, with the right charset.
$res = Mysql::query('SELECT * FROM my_table');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.