PHP code example of vertilia / pdo-wrap

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

    

vertilia / pdo-wrap example snippets




use PDO;

$pdo = new PDO('sqlite::memory:');
$sth = $pdo->prepare("SELECT name, join_date, acl FROM users WHERE acl IN(:a1,:a2)");
$sth->bindValue(':a1', 9, PDO::PARAM_INT);
$sth->bindValue(':a2', 10, PDO::PARAM_INT);
$sth->execute();
$result = $sth->fetchAll();



use PDO;
use Vertilia\PdoWrap\PdoWrap;

$pdo_wrap = new PdoWrap('sqlite::memory:');
$result = $pdo_wrap->queryFetchAll(
    "SELECT name, join_date, acl FROM users WHERE acl IN(:acls)",
    [':acls[i]' => [9, 10]]
);



$db = new PdoWrap($db_dsn, $db_user, $db_pass, $db_options);

$admins_rows = $db->queryFetchAll('SELECT * FROM users WHERE acl >= ?', [90]);

$admins_list = $db->queryFetchAll(
    'SELECT id, name FROM users WHERE acl >= :acl',
    [':acl<i>' => 90],
    PDO::FETCH_KEY_PAIR
);

$admins_count = $db->queryFetchOne(
    'SELECT COUNT(*) FROM users WHERE acl >= :acl',
    [':acl<i>' => 90],
    PDO::FETCH_COLUMN
);

$admins_updated = $db->queryExecute(
    'UPDATE users SET connected = :conn WHERE acl >= :acl',
    [
        ':acl<i>' => 90,
        ':conn<b>' => false,
    ]
);