PHP code example of royallthefourth / smooth-pdo

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

    

royallthefourth / smooth-pdo example snippets


new RoyallTheFourth\SmoothPdo\DataObject(\PDO $db)

$calories = 150;
$colour = 'red';

$sth = $dbh->prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour');
$sth->bindParam(':calories', $calories, PDO::PARAM_INT);
$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
$sth->execute();


$calories = 150;
$colour = 'red';

$dbh->prepare('SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour')
    ->bindParam(':calories', $calories, PDO::PARAM_INT)
    ->bindParam(':colour', $colour, PDO::PARAM_STR, 12)
    ->execute();