PHP code example of liquidbox / pdo-extension

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

    

liquidbox / pdo-extension example snippets


$db = new PDO('odbc:dbname=hollywood;host=127.0.0.1', 'root');

$db = new PDO(
	'mysql:dbname=hollywood;host=127.0.0.1',
	$config['db.username'],
	$config['db.password'],
    [
        PDO::MYSQL_ATTR_SSL_KEY  => '/path/to/client-key.pem',
        PDO::MYSQL_ATTR_SSL_CERT => '/path/to/client-cert.pem',
        PDO::MYSQL_ATTR_SSL_CA   => '/path/to/ca-cert.pem'
    ]
);

$res = $db->query(['UPDATE actor SET oscars = oscars + 1 WHERE id = %d', 4600]);

$db->insert(
    'actor',
    [
        'name' => "Anna Kendrick",
		'gender' => "female",
        'born' => (new DateTime("August 9, 1985"))->format('Y-m-d')
    ]
);

if ($page > 1) {
	$offset = ($page - 1) * $limit
}

$res = $db->select(
	['name', 'picture'],
	'actor',
	'name LIKE "%' . $middleName . '%" AND gender = "male"',
	isset($offset) ? [$offset, $limit] : $limit
);

$actors = $res->fetchAll();

$db->update(
	'actor',
	['oscars' => 'oscars + 1'],
	'name = "Michael Thomas Green"'
);

$db->update(
	'actor',
	[
		['latest_role' => "Moe",   'name' => "Moses Harry Horwitz"],
		['latest_role' => "Larry", 'name' => "Louis Feinberg"],
		['latest_role' => "Curly", 'name' => "Jerome Lester Horwitz"]
	]
);

$db->delete('actor', 'name = "Joey Tribbiani"');