PHP code example of tomwright / extended-pdo

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

    

tomwright / extended-pdo example snippets


$db = ExtendedPDO::createConnection($dsn, $username, $password, 'my-main-db');
$db2 = ExtendedPDO::getInstance('my-main-db');

var_dump($db === $db2) // TRUE

// Returns an array of records
$db->queryAll('SELECT * FROM users WHERE username = :username', [':username' => 'Tom']);

// Returns the first record
$db->queryRow('SELECT * FROM users WHERE username = :username LIMIT 1', [':username' => 'Tom']);