PHP code example of leeqvip / database

1. Go to this page and download the library: Download leeqvip/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/ */

    

leeqvip / 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',
];

$manager = new Manager($config);
$connection = $manager->getConnection();

$connection->query('SELECT * FROM `users` WHERE `id` = :id', ['id' => 1]);

$connection->execute('UPDATE `users` SET `name` = "joker" where `id` = :id', ['id' => 1]);