1. Go to this page and download the library: Download myjw3b/php-pdo-chainer 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/ */
myjw3b / php-pdo-chainer example snippets
use \PDOChainer\PDOChainer;
$params = array('host'=>'127.0.0.1', 'dbname'=>'test', 'user'=>'root', 'pass'=>'');
$db = new PDOChainer($params);
// Fetch all rows
$result = $db->query("SELECT * FROM `table`")
->fetchAll(PDO::FETCH_NUM);
// Fetch first row
$row = $db->prepare("SELECT * FROM `table` WHERE `id` = :id")
->bindValue(':id', 1, PDO::PARAM_INT)
->execute()
->fetch(PDO::FETCH_ASSOC);