时间:2021-07-01 10:21:17 帮助过:17人阅读
query("update {$tpre}member set ttid='2000' where userid123='10000'");
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error); //mysql连接错误抛出
exit();
}
if (!$mysqli->query("SET a=1")) {
printf("Errormessage: %s\n", $mysqli->error); //mysql查询错误抛出
}
?>
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if (!mysqli_query($link, "SET a=1")) {
printf("Errormessage: %s\n", mysqli_error($link));
}
?>
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
// $mysqli->affected_rows 取得前一次 MySQLI 操作所影响的记录行数
$mysqli->query("update {$tpre}member set ttid='2000' where userid123='10000'");
printf("Affected rows (UPDATE): %d\n", $mysqli->affected_rows);