PHP code example of vanokk / singleton-pdo

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

    

vanokk / singleton-pdo example snippets



t = 'localhost';
$dbName = 'users';
$userName = 'root';
$userPassword = 'root';

$db = SingletonPDO\DB::connect('mysql:host='.$host.';dbname='.$dbName, $userName, $userPassword);

$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$query = new SingletonPDO\DBQuery($db);

$sql = "SELECT * FROM users";
echo $query->queryAll($sql);