mysql_fetch_row

(PHP 4, PHP 5)

mysql_fetch_row從結(jié)果集中取得一行作為枚舉數(shù)組

說明

mysql_fetch_row(resource $result): array

返回根據(jù)所取得的行生成的數(shù)組,如果沒有更多行則返回 false。

mysql_fetch_row() 從和指定的結(jié)果標(biāo)識關(guān)聯(lián)的結(jié)果集中取得一行數(shù)據(jù)并作為數(shù)組返回。每個結(jié)果的列儲存在一個數(shù)組的單元中,偏移量從 0 開始。

依次調(diào)用 mysql_fetch_row() 將返回結(jié)果集中的下一行,如果沒有更多行則返回 false。

參見 mysql_fetch_array(),mysql_fetch_assoc()mysql_fetch_object(),mysql_data_seek(),mysql_fetch_lengths()mysql_result()

參數(shù)

result

resource 型的結(jié)果集。此結(jié)果集來自對 mysql_query() 的調(diào)用。

返回值

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.

范例

示例 #1 Fetching one row with mysql_fetch_row()

<?php
$result 
mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!
$result) {
    echo 
'Could not run query: ' mysql_error();
    exit;
}
$row mysql_fetch_row($result);

echo 
$row[0]; // 42
echo $row[1]; // the email value
?>

注釋

注意: 此函數(shù)將 NULL 字段設(shè)置為 PHP null 值。

參見