diff --git a/language/predefined/closure/bindto.xml b/language/predefined/closure/bindto.xml
index bc3cfd970b..0773a984d9 100644
--- a/language/predefined/closure/bindto.xml
+++ b/language/predefined/closure/bindto.xml
@@ -115,6 +115,7 @@ $cl = $ob1->getClosure();
echo $cl(), "\n";
$cl = $cl->bindTo($ob2);
echo $cl(), "\n";
+?>
]]>
&example.outputs.similar;
diff --git a/reference/eio/functions/eio-custom.xml b/reference/eio/functions/eio-custom.xml
index 66505b3ef5..4b366e9569 100644
--- a/reference/eio/functions/eio-custom.xml
+++ b/reference/eio/functions/eio-custom.xml
@@ -34,12 +34,12 @@
Specifies the request function that should match the following prototype:
-
callback is event completion callback that should match the following
prototype:
-
diff --git a/reference/mongo/updates.xml b/reference/mongo/updates.xml
index 439f3f6606..7a0a8eeafe 100644
--- a/reference/mongo/updates.xml
+++ b/reference/mongo/updates.xml
@@ -26,7 +26,7 @@
For example, a modifying update could add a new field to a document.
update(array("username" => "joe"), array('$set' => array("twitter" => "@j
/** now the document will look like:
* {"username" : "joe", "password" : "...", "email" : "...", "twitter" : "@joe4153"}
*/
-
+?>
]]>
@@ -52,7 +52,7 @@ $coll->update(array("username" => "joe"), array('$set' => array("twitter" => "@j
document.
update(array("username" => "joe"), array("userId" => 12345, "info" => arr
* "likes" : []
* }
*/
-
+?>
]]>
diff --git a/reference/mongo/writes.xml b/reference/mongo/writes.xml
index 7415ab1c88..9908c0df7d 100644
--- a/reference/mongo/writes.xml
+++ b/reference/mongo/writes.xml
@@ -36,12 +36,12 @@
insert($someDoc);
$collection->update($criteria, $newObj);
$collection->insert($somethingElse);
$collection->remove($something, array("safe" => true));
-
+?>
]]>
@@ -62,9 +62,9 @@ $collection->remove($something, array("safe" => true));
insert($someDoc, array("safe" => 3));
-
+?>
]]>
diff --git a/reference/mysqli/quickstart.xml b/reference/mysqli/quickstart.xml
index 66a5bb2d8e..108b532199 100644
--- a/reference/mysqli/quickstart.xml
+++ b/reference/mysqli/quickstart.xml
@@ -34,6 +34,7 @@
Easy migration from the old mysql extension
]]>
&example.outputs;
@@ -73,6 +75,7 @@ Please, do not use the mysql extension for new developments.
Object-oriented and procedural interface
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: " . $mysqli->connect_error;
$res = $mysqli->query("SELECT 'choices to please everybody,' AS _msg FROM DUAL");
$row = $res->fetch_assoc();
echo $row['_msg'];
+?>
]]>
&example.outputs;
@@ -114,8 +118,9 @@ A world full of choices to please everybody.
Bad coding style
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: " . $mysqli->connect_error;
$res = mysqli_query($mysqli, "SELECT 'Possible but bad style.' AS _msg FROM DUAL");
@@ -124,6 +129,7 @@ if (!$res)
if ($row = $res->fetch_assoc())
echo $row['_msg'];
+?>
]]>
&example.outputs;
@@ -168,15 +174,17 @@ Possible but bad style.
Special meaning of localhost
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
echo $mysqli->host_info . "\n";
$mysqli = new mysqli("127.0.0.1", "user", "password", "database", 3306);
-if ($mysqli->connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
echo $mysqli->host_info . "\n";
+?>
]]>
&example.outputs;
@@ -354,14 +362,16 @@ mysqli.default_socket=/tmp/mysql.sock
Bad coding style
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
!$mysqli->query("CREATE TABLE test(id INT)") ||
!$mysqli->query("INSERT INTO test(id) VALUES (1)"))
echo "Table creation failed: (" . $mysqli->errno . ") " . $mysqli->error;
+?>
]]>
@@ -389,8 +399,9 @@ if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
Navigation through buffered results
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -411,6 +422,7 @@ echo "Result set order...\n";
$res->data_seek(0);
while ($row = $res->fetch_assoc())
echo " id = " . $row['id'] . "\n";
+?>
]]>
&example.outputs;
@@ -442,12 +454,14 @@ Result set order...
Navigation through buffered results
real_query("SELECT id FROM test ORDER BY id ASC");
$res = $mysqli->use_result();
echo "Result set order...\n";
while ($row = $res->fetch_assoc())
echo " id = " . $row['id'] . "\n";
+?>
]]>
@@ -472,8 +486,9 @@ while ($row = $res->fetch_assoc())
Text protocol returns strings by default
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -486,6 +501,7 @@ $row = $res->fetch_assoc();
printf("id = %s (%s)\n", $row['id'], gettype($row['id']));
printf("label = %s (%s)\n", $row['label'], gettype($row['label']));
+?>
]]>
&example.outputs;
@@ -510,10 +526,11 @@ label = a (string)
Native data types with mysqlnd and conneciton option
options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1);
$mysqli->real_connect("example.com", "user", "password", "database");
-if ($mysqli->connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -526,6 +543,7 @@ $row = $res->fetch_assoc();
printf("id = %s (%s)\n", $row['id'], gettype($row['id']));
printf("label = %s (%s)\n", $row['label'], gettype($row['label']));
+?>
]]>
&example.outputs;
@@ -579,8 +597,9 @@ label = a (string)
First stage: prepare
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
/* Non-prepared statement */
@@ -591,6 +610,7 @@ if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
/* Prepared statement, stage 1: prepare */
if (!($stmt = $mysqli->prepare("INSERT INTO test(id) VALUES (?)")))
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
+?>
]]>
@@ -606,6 +626,7 @@ if (!($stmt = $mysqli->prepare("INSERT INTO test(id) VALUES (?)")))
Second stage: bind and execute
bind_param("i", $id))
@@ -613,6 +634,7 @@ if (!$stmt->bind_param("i", $id))
if (!$stmt->execute())
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
+?>
]]>
@@ -631,8 +653,9 @@ if (!$stmt->execute())
INSERT prepared once, executed multiple times
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
/* Non-prepared statement */
@@ -663,6 +686,7 @@ $stmt->close();
/* Non-prepared statement */
$res = $mysqli->query("SELECT id FROM test");
var_dump($res->fetch_all());
+?>
]]>
&example.outputs;
@@ -717,8 +741,10 @@ array(4) {
Less round trips using multi-INSERT SQL
query("INSERT INTO test(id) VALUES (1), (2), (3), (4)"))
echo "Multi-INSERT failed: (" . $mysqli->errno . ") " . $mysqli->error;
+?>
]]>
@@ -741,8 +767,9 @@ if (!$mysqli->query("INSERT INTO test(id) VALUES (1), (2), (3), (4)"))
Native datatypes
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -757,6 +784,7 @@ $row = $res->fetch_assoc();
printf("id = %s (%s)\n", $row['id'], gettype($row['id']));
printf("label = %s (%s)\n", $row['label'], gettype($row['label']));
+?>
]]>
&example.outputs;
@@ -790,8 +818,9 @@ label = a (string)
Output variable binding
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -814,6 +843,7 @@ while ($stmt->fetch())
printf("id = %s (%s), label = %s (%s)\n",
$out_id, gettype($out_id),
$out_label, gettype($out_label));
+?>
]]>
&example.outputs;
@@ -850,8 +880,9 @@ id = 1 (integer), label = a (string)
Using mysqli_result to fetch results
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -869,6 +900,7 @@ if (!($res = $stmt->get_result()))
echo "Getting result set failed: (" . $stmt->errno . ") " . $stmt->error;
var_dump($res->fetch_all());
+?>
]]>
&example.outputs;
@@ -896,8 +928,9 @@ array(1) {
Buffered result set for flexible read out
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -919,6 +952,7 @@ for ($row_no = ($res->num_rows - 1); $row_no >= 0; $row_no--) {
var_dump($res->fetch_assoc());
}
$res->close();
+?>
]]>
&example.outputs;
@@ -1097,8 +1131,9 @@ array(2) {
Calling a stored procedure
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -1116,6 +1151,7 @@ if (!($res = $mysqli->query("SELECT id FROM test")))
echo "SELECT failed: (" . $mysqli->errno . ") " . $mysqli->error;
var_dump($res->fetch_assoc());
+?>
]]>
&example.outputs;
@@ -1141,8 +1177,9 @@ array(1) {
Using session variables
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP PROCEDURE IF EXISTS p") ||
@@ -1159,6 +1196,7 @@ if (!($res = $mysqli->query("SELECT @msg as _p_out")))
$row = $res->fetch_assoc();
echo $row['_p_out'];
+?>
]]>
&example.outputs;
@@ -1199,8 +1237,9 @@ Hi!
Fetching results from stored procedures
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -1225,6 +1264,7 @@ do {
echo "Store failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
} while ($mysqli->more_results() && $mysqli->next_result());
+?>
]]>
&example.outputs;
@@ -1285,8 +1325,9 @@ array(3) {
Stored Procedures and Prepared Statements
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -1315,6 +1356,7 @@ do {
echo "Store failed: (" . $stmt->errno . ") " . $stmt->error;
}
} while ($stmt->more_results() && $stmt->next_result());
+?>
]]>
@@ -1327,6 +1369,7 @@ do {
Stored Procedures and Prepared Statements using bind API
prepare("CALL p()")))
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
@@ -1342,6 +1385,7 @@ do {
while ($stmt->fetch())
echo "id = $id_out\n";
} while ($stmt->more_results() && $stmt->next_result());
+?>
]]>
@@ -1380,8 +1424,9 @@ do {
Multiple Statements
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
if (!$mysqli->query("DROP TABLE IF EXISTS test") ||
@@ -1401,6 +1446,7 @@ do {
$res->free();
}
} while ($mysqli->more_results() && $mysqli->next_result());
+?>
]]>
&example.outputs;
@@ -1443,10 +1489,12 @@ array(1) {
SQL ijnection
query("SELECT 1; DROP TABLE mysql.user");
if (!$res)
echo "Error executing query: (" . $mysqli->errno . ") " . $mysqli->error;
+?>
]]>
&example.outputs;
@@ -1492,8 +1540,9 @@ Error executing query: (1064) You have an error in your SQL syntax; check the ma
Setting auto commit mode with SQL and through the API
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
/* Recommended: using API to control transactional settings */
@@ -1502,6 +1551,7 @@ $mysqli->autocommit(false);
/* Won't be monitored and recognized by the replication and the load balancing plugin */
if (!$mysqli->query('SET AUTOCOMMIT = 0'))
echo "Query failed: (" . $mysqli->errno . ") " . $mysqli->error;
+?>
]]>
@@ -1518,6 +1568,7 @@ if (!$mysqli->query('SET AUTOCOMMIT = 0'))
Commit and rollback
autocommit(false);
@@ -1526,6 +1577,7 @@ $mysqli->rollback();
$mysqli->query("INSERT INTO test(id) VALUES (2)");
$mysqli->commit();
+?>
]]>
@@ -1563,12 +1615,14 @@ $mysqli->commit();
Accessing result set meta data
connect_errno))
+if ($mysqli->connect_errno)
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
$res = $mysqli->query("SELECT 1 AS _one, 'Hello' AS _two FROM DUAL");
var_dump($res->fetch_fields());
+?>
]]>
&example.outputs;
@@ -1651,10 +1705,12 @@ array(2) {
Prepared statements metadata
prepare("SELECT 1 AS _one, 'Hello' AS _two FROM DUAL");
$stmt->execute();
$res = $stmt->result_metadata();
var_dump($res->fetch_fields());
+?>
]]>