In PHP, res is a variable used to store the MySQL database query result set, which can be obtained using the mysqli_query() function and traversed through functions such as mysqli_fetch_array(), mysqli_fetch_assoc(), and finally mysqli_free_result() Function releases the connection to the database server.
res
What is res# in PHP ##?
res is a variable used to store the result set of a MySQL database query. It is a resource type that represents a resource pointing to a MySQL server connection.
How to useres
mysqli_query() function, as shown below:
<code class="php">$res = mysqli_query($conn, "SELECT * FROM users");</code>
is the connection handle pointing to the MySQL server.
is the query to be executed.
mysqli_query() The function returns a
res variable containing the query result set. Operations on
res
res, including:
: Gets a row in the result set as an associative array or numeric array.
: Get a row in the result set as an associative array.
: Get a row in the result set as a numeric array.
: Get a row in the result set as an object.
Releaseres
mysqli_free_result() The function release is associated with
res resources, as follows:
<code class="php">mysqli_free_result($res);</code>
res is very important because it releases the connection to the database server.
The above is the detailed content of What does res mean in php. For more information, please follow other related articles on the PHP Chinese website!