1. Go to this page and download the library: Download techone/database 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/ */
techone / database example snippets
use Leeqvip\Database\Manager;
$config = [
'type' => 'mysql', // mysql, pgsql, sqlite, sqlsrv
'hostname' => '127.0.0.1',
'database' => 'test',
'username' => 'root',
'password' => 'abc-123',
'hostport' => '3306',
'charset' => 'utf8mb4',
];
$manager = new Manager($config);
$connection = $manager->getConnection(); // lazily creates and caches one Connection
// Returns all matching rows as an array of associative arrays
$rows = $connection->query('SELECT * FROM `users` WHERE `id` = :id', ['id' => 1]);
// Returns the number of affected rows
$count = $connection->execute(
'UPDATE `users` SET `name` = :name WHERE `id` = :id',
['name' => 'joker', 'id' => 1]
);
$rows = $connection->query('SELECT * FROM `users` WHERE `id` = ?', [1]);