PHP code example of bentools / simple-dbal

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

    

bentools / simple-dbal example snippets


use BenTools\SimpleDBAL\Model\Credentials;
use BenTools\SimpleDBAL\Model\SimpleDBAL;

$credentials = new Credentials('localhost', 'user', 'password', 'database');
$cnx         = SimpleDBAL::factory($credentials, SimpleDBAL::PDO);
$query       = "SELECT `id`, `name` FROM guys WHERE created_at > ?";
foreach ($cnx->execute($query, [new DateTime('-1 month')]) as $item) {
    var_dump($item['name']);
}