Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP mysqli_query() Function

PHP mysqli_query() Function

PHP MySQLi Reference Manual PHP MySQLi Reference Manual

Execute a query against the database:

Query the database


Definition and Usage

The mysqli_query() function executes a query against the database.


Syntax

mysqli_query(

connection,query,resultmode

)

;

Parameters Description
connection Required. Specifies the MySQL connection to use.
query Required, specifies the query string.
resultmode

Optional. A constant. Can be any of the following values:

  • MYSQLI_USE_RESULT (use this if you need to retrieve large amounts of data)
  • MYSQLI_STORE_RESULT (default)
  • |

    Technical Details

    Return Value: For a successful SELECT, SHOW, DESCRIBE or EXPLAIN query, a mysqli_result object is returned. For other successful queries, TRUE is returned. If it fails, FALSE is returned.
    PHP Version: 5+
    Changelog: The asynchronous query capability was added in PHP 5.3.0.

    PHP MySQLi Reference Manual PHP MySQLi Reference Manual