1. Go to this page and download the library: Download porthorian/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/ */
porthorian / pdo-wrapper example snippets
declare(strict_types=1);
aseModel;
use Porthorian\PDOWrapper\DBPool;
use Porthorian\PDOWrapper\DBWrapper;
$dbname = 'the-schema-you-will-connect-to';
$host = '127.0.0.1';
$user = 'your-amazing-username';
$password = 'your-secret-password';
$model = new DatabaseModel($dbname, $host, $user, $password);
//$model->setPort(3306); //Using another port? you can set that on the model.
DBPool::addPool($model);
/**
* You can opt to connect to the database if you want to do that now or wait till the first call of that dbname.
* DBWrapper will connect to it automatically.
* Example:
*/
// DBPool::connectDatabase($dbname);
/**
* Wanna set a DefaultDatabase that isn't the first database pool added?
* You can do that with DBWrapper.
*/
// DBWrapper::setDefaultDB($dbname);
declare(strict_types=1);
pper;
/**
* This query will return an multidimensional array
* Each record/row returned will be returned in the way the query has outputted them.
*/
$results = DBWrapper::PExecute('SELECT * FROM your_table WHERE x = ?', [$your_statement]);
foreach ($results as $result)
{
var_dump($result); // The row being returned as an array. All values pertaining to the row will be here.
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.