1. Go to this page and download the library: Download nstwf/mysql-connection-pool 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/ */
nstwf / mysql-connection-pool example snippets
$pool = new \Nstwf\MysqlConnectionPool\Pool('localhost:3306');
$pool
->getConnection()
->then(function (\Nstwf\MysqlConnection\ConnectionInterface $connection) use ($pool) {
$connection->query("UPDATE users SET blocked = 1 WHERE id = 3");
$pool->releaseConnection($connection);
});
$pool = new \Nstwf\MysqlConnectionPool\Pool('localhost:3306', null, 10, false);
$pool
->getConnection()
->then(function (\Nstwf\MysqlConnection\ConnectionInterface $connection) {
$connection->query("UPDATE users SET active = 0 WHERE id = 2");
$connection->query("UPDATE users SET blocked = 1 WHERE id = 3");
$pool->releaseConnection($connection);
});
$pool->releaseConnection($connection);
$pool->query("UPDATE users SET active = 0 WHERE id = ?", [2]);
$pool->transaction(function(\Nstwf\MysqlConnection\ConnectionInterface $connection) {
$connection->query("UPDATE users SET active = 0 WHERE id = 2");
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.