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);
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...