1. Go to this page and download the library: Download particlebits/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/ */
particlebits / pdo example snippets
$dsn = 'mysql:host=your_db_host;dbname=your_db_name;charset=utf8';
$usr = 'your_db_username';
$pwd = 'your_db_password';
$pdo = new \Pb\PDO\Database($dsn, $usr, $pwd);
// SELECT * FROM users WHERE id = ?
$stmt = $pdo
->select()
->from('users')
->where('id', '=', 1234)
->execute();
$data = $stmt->fetch();
// INSERT INTO users (id , usr , pwd) VALUES (? , ? , ?)
$stmt = $pdo
->insert(['id', 'usr', 'pwd'])
->into('users')
->values([1234, 'your_username', 'your_password']);
$insertId = $stmt->execute(true); // true returns insert ID
// UPDATE users SET pwd = ? WHERE id = ?
$stmt = $pdo
->update(['pwd' => 'your_new_password'])
->table('users')
->where('id', '=', 1234);
$affectedRows = $stmt->execute();
// DELETE FROM users WHERE id = ?
$stmt = $pdo
->delete()
->from('users')
->where('id', '=', 1234);
$affectedRows = $stmt->execute();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.