事务、更新、查询
use Swoole\Coroutine\MySQL;
use function Swoole\Coroutine\run;run(function () {$db = new MySQL();$ret1 = $db->connect(['host' => '127.0.0.1','port' => 3306,'user' => 'root','password' => 'ecece8577f2a660a','database' => 'mysqldemo',]);$stmt = $db->prepare('update Users set Banned = ? where Users_Id = ?');if ($stmt == false) {var_dump($db->errno, $db->error);} else {$ret2 = $stmt->execute(array('ws',10));var_dump($ret2);}});
[root@bogon swoole]# php AysMysql.php
bool(true)
![在这里插入图片描述](https://img.php1.cn/3cd4a/1eebe/cd5/5287a7b3296ea13e.webp?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaWd1YW5nMTAy,size_16,color_FFFFFF,t_70)