PHP code example of grizz-it / dbal-pdo

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

    

grizz-it / dbal-pdo example snippets




use GrizzIt\Dbal\Pdo\Factory\PdoConnectionFactory;

$factory = new PdoConnectionFactory;



$connection = $factory->create(
    'mysql:dbname=test;host=localhost',
    'test',
    'test'
);

// Immediate call to the database.
$result = $connection->query($queryObject);

// Transactional call to the database.
$connection->startTransaction();
$result = $connection->query($queryObject);
$connection->commit();
// It is also possible to rollback a transaction before it is committed:
$connection->rollback();

$connection->lastTransactionId();

count($result); //Returns affected rows.