MySQL Improved Extension (
Mysqli
)
2404
•
mysqlnd
on Windows returns an error code 2006. This error message means
“server has gone away”.
•
libmysqlclient
on all platforms returns an error code 2006. This error
message means “server has gone away”.
Parameters
link
Procedural style only: A link identifier returned by
mysqli_connect
or
mysqli_init
query
The query string.
Data inside the query should be
properly escaped
.
resultmode
Either the constant
MYSQLI_USE_RESULT
or
MYSQLI_STORE_RESULT
depending on the desired behavior. By
default,
MYSQLI_STORE_RESULT
is used.
If you use
MYSQLI_USE_RESULT
all subsequent calls will
return error
Commands out of sync
unless you call
mysqli_free_result
With
MYSQLI_ASYNC
(available with mysqlnd), it is possible to
perform query asynchronously.
mysqli_poll
is then used to get
results from such queries.
Return Values
Returns
FALSE
on failure. For successful
SELECT, SHOW, DESCRIBE
or
EXPLAIN
queries
mysqli_query
will return a
mysqli_result
object. For other successful queries
mysqli_query
will return
TRUE
.
Changelog
Version
Description
5.3.0
Added the ability of async queries.
Examples
Example 20.137.
mysqli::query
example
Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
/* Create table doesn't return a resultset */
if ($mysqli->query("CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
printf("Table myCity successfully created.\n");
}
/* Select queries return a resultset */
if ($result = $mysqli->query("SELECT Name FROM City LIMIT 10")) {
printf("Select returned %d rows.\n", $result->num_rows);
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...