PHP code example of nadyita / reactdb
1. Go to this page and download the library: Download nadyita/reactdb 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/ */
nadyita / reactdb example snippets
$loop = React\EventLoop\Factory::create();
$factory = new Clue\React\SQLite\Factory($loop);
$db = new Nadyita\ReactDB\SQLite($factory->openLazy('test.db'));
$db->exec('CREATE TABLE IF NOT EXISTS foo (id INTEGER PRIMARY KEY AUTOINCREMENT, bar STRING)');
$name = 'Alice';
$db->query('INSERT INTO foo (bar) VALUES (?)', [$name])->then(
function (Nadyita\ReactDB\Result $result) use ($name) {
echo 'New ID for ' . $name . ': ' . $result->getinsertID() . PHP_EOL;
}
);
$db->quit();
$loop->run();