Hướng dẫn mysqli fetch one row

❮ PHP MySQLi Reference

Example - Object Oriented style

Fetch rows from a result-set:


Look at example of procedural style at the bottom.

Definition and Usage

The fetch_row[] / mysqli_fetch_row[] function fetches one row from a result-set and returns it as an enumerated array.

Syntax

Object oriented style:

$mysqli_result -> fetch_row[]

Procedural style:

Parameter Values

ParameterDescription
result Required. Specifies a result set identifier returned by mysqli_query[], mysqli_store_result[] or mysqli_use_result[]

Technical Details

Return Value:PHP Version:
Returns an array of strings that corresponds to the fetched row. NULL if there are no more rows in result set
5+

Example - Procedural style

Fetch rows from a result-set:


❮ PHP MySQLi Reference


[PHP 4, PHP 5]

mysql_fetch_rowGet a result row as an enumerated array

Description

mysql_fetch_row[resource $result]: array

Parameters

result

The result resource that is being evaluated. This result comes from a call to mysql_query[].

Return Values

Returns an numerical array of strings that corresponds to the fetched row, or false if there are no more rows.

mysql_fetch_row[] fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.

Examples

Example #1 Fetching one row with mysql_fetch_row[]

Chủ Đề