PHP code example of pahenrus / react-mysqli
1. Go to this page and download the library: Download pahenrus/react-mysqli 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/ */
pahenrus / react-mysqli example snippets
$loop = \React\EventLoop\Factory::create();
$makeConnection = function () {
return mysqli_connect('localhost', 'vagrant', '', 'test');
};
$mysql = new \React\MySQLi\Client($loop, new \React\MySQLi\Pool($makeConnection, 10));
$mysql->query('select * from test')->then(
function (\React\MySQLi\Result $result) {
print_r($result->all());
},
function ($error) {
error_log($error);
}
);
$loop->run();