1. Go to this page and download the library: Download kansept/dbi 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/ */
kansept / dbi example snippets
$mysqli = new mysqli('localhost', 'user', 'password', 'db');
$mysqli->set_charset('UTF-8');
$db = new \Kansept\Dbi\Db($mysqli);
$db->exec("SELECT * FROM `demo` WHERE id = ?", [1])->row(); // return array
$db->exec("SELECT * FROM `demo`")->rows(); // return array
$db->exec("SELECT * FROM `demo` WHERE id = ?", [1])->one(); // return object
$db->exec("SELECT * FROM `demo`")->all(); // return object array
$db->exec("SELECT * FROM `demo`")->count(); // return count rows
$db->exec("SELECT * FROM `demo`")->yield(); // return yield