1. Go to this page and download the library: Download victorvolpe/php-pdo-wrapper 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/ */
victorvolpe / php-pdo-wrapper example snippets
use VictorVolpe\PhpPdoWrapper\DB;
$db = new DB(
dsn: 'mysql:host=localhost;dbname=testdb;charset=utf8mb4',
user: 'your_username',
pass: 'your_password'
);
$users = $db->query("SELECT * FROM users WHERE status = :status", [
'status' => 'active'
]);
$user = $db->row("SELECT * FROM users WHERE id = :id", [
'id' => 1
]);
$emails = $db->column("SELECT email FROM users WHERE status = :status", [
'status' => 'active'
]);
$email = $db->single("SELECT email FROM users WHERE id = :id", [
'id' => 1
]);