mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
fix parentheses in examples
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335552 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
f3aee9f107
commit
7ecbb29bdb
1 changed files with 7 additions and 7 deletions
|
@ -322,12 +322,12 @@ if (!$mysqli->query("INSERT INTO test(id) VALUES (1)")) {
|
|||
}
|
||||
|
||||
/* read-only: statement will be run on a slave */
|
||||
if (!($res = $mysqli->query("SELECT id FROM test")) {
|
||||
if (!($res = $mysqli->query("SELECT id FROM test"))) {
|
||||
printf("[%d] %s\n", $mysqli->errno, $mysqli->error);
|
||||
} else {
|
||||
$row = $res->fetch_assoc();
|
||||
$res->close();
|
||||
printf("Slave returns id = '%s'\n", $row['id'];
|
||||
printf("Slave returns id = '%s'\n", $row['id']);
|
||||
}
|
||||
$mysqli->close();
|
||||
?>
|
||||
|
@ -683,25 +683,25 @@ if (!$mysqli->query("START TRANSACTION")) {
|
|||
}
|
||||
|
||||
/* Prevent connection switch! */
|
||||
if (!$mysqli->query(sprintf("/*%s*/INSERT INTO test(id) VALUES (1)", MYSQLND_MS_LAST_USED_SWITCH)))) {
|
||||
if (!$mysqli->query(sprintf("/*%s*/INSERT INTO test(id) VALUES (1)", MYSQLND_MS_LAST_USED_SWITCH))) {
|
||||
/* Please do proper ROLLBACK in your code, don't just die */
|
||||
die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
|
||||
}
|
||||
if ($res = $mysqli->query(sprintf("/*%s*/SELECT COUNT(*) AS _num FROM test", MYSQLND_MS_LAST_USED_SWITCH)))) {
|
||||
if ($res = $mysqli->query(sprintf("/*%s*/SELECT COUNT(*) AS _num FROM test", MYSQLND_MS_LAST_USED_SWITCH))) {
|
||||
$row = $res->fetch_assoc();
|
||||
$res->close();
|
||||
if ($row['_num'] > 1000) {
|
||||
if (!$mysqli->query(sprintf("/*%s*/INSERT INTO events(task) VALUES ('cleanup')", MYSQLND_MS_LAST_USED_SWITCH)))) {
|
||||
if (!$mysqli->query(sprintf("/*%s*/INSERT INTO events(task) VALUES ('cleanup')", MYSQLND_MS_LAST_USED_SWITCH))) {
|
||||
die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
|
||||
}
|
||||
if (!$mysqli->query(sprintf("/*%s*/UPDATE log SET last_update = NOW()", MYSQLND_MS_LAST_USED_SWITCH)))) {
|
||||
if (!$mysqli->query(sprintf("/*%s*/UPDATE log SET last_update = NOW()", MYSQLND_MS_LAST_USED_SWITCH))) {
|
||||
die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
|
||||
}
|
||||
if (!$mysqli->query(sprintf("/*%s*/COMMIT", MYSQLND_MS_LAST_USED_SWITCH)))) {
|
||||
if (!$mysqli->query(sprintf("/*%s*/COMMIT", MYSQLND_MS_LAST_USED_SWITCH))) {
|
||||
die(sprintf("[%d] %s\n", $mysqli->errno, $mysqli->error));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue