1. Go to this page and download the library: Download websvc/php-mysql-db 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/ */
websvc / php-mysql-db example snippets
use PhpMysqlDb/Db;
$dbConn = new Db('host', 'username', 'password', 'database');
$sql = "SELECT * FROM table_name";
$exec = $dbConn->query($sql);
while ($row = $dbConn->fetch_assoc()) {
echo "<br/>" . print_r($row, true);
}
use PhpMysqlDb/Db;
$dbConn = new Db('host', 'username', 'password', 'database');
$sql = "SELECT * FROM table_name";
$exec = $dbConn->select($sql);
if ($exec) {
echo "<br><pre>";
print_r($exec);
echo "</pre><br>";
}
use PhpMysqlDb/Db;
use websvc/PhpMonologWrapper;
$log = new PhpMonologWrapper('logger-name', [
'logFile' => '/tmp/mylog.log',
'loggerLevel'=> 'DEBUG', // Set logging level
'toStderr'=> true // Log output to stderr
]);
$dbConn = new Db('host', 'username', 'password', 'database');
$dbConn->setLogger($log);
$sql = "SELECT * FROM table_name";
$exec = $dbConn->query($sql);
while ($row = $dbConn->fetch_assoc()) {
echo "<br/>" . print_r($row, true);
}
bash
composer
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.