-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
37 lines (30 loc) · 884 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once dirname(__FILE__, 3) . '/vendor/autoload.php';
use Amp;
Amp\Loop::run(
function () {
$config = Amp\Mysql\ConnectionConfig::fromString(
"host=localhost user=root pass= db=amphp"
);
/**
* @var \Amp\Mysql\Pool $pool
*/
$pool = Amp\Mysql\pool($config);
/**
* @var \Amp\Mysql\Statement $statement
*/
$statement = yield $pool
->prepare("INSERT INTO users (name, email, password)VALUES(:name, :email, :password)");
/**
* @var \Amp\Mysql\ResultSet $result
*/
yield $statement->execute(
[
'name' => 'Mahmoud Mohamed Ramadan',
'email' => '[email protected]',
'password' => md5('admin'),
]
);
echo 'user saved successfully';
}
);