w3resource logo


PHP mysql_fetch_row function

PHP : mysql_fetch_row() function

<<PreviousNext>>

Description

The mysql_fetch_row() is used to fetch a row of data from a result handle.

Version

(PHP 4 and above)

Syntax

mysql_fetch_row(result)

Parameter

Name Description Required/ Optional Type
result Refers to the resource return by a valid mysql query (calling by mysql_query() function). Required Resource

Return value

An numerical array containing the fetched row, or FALSE if there are no more rows.

Value Type : Array.

Example :

<?php
mysql_connect("localhost", "root", "mypass");
mysql_select_db("tutorials");
$result = mysql_query("select * from tutorials");
$row = mysql_fetch_row($result);
echo $row[1];
?>

Output :

html

See also

PHP Function Reference

mysql_fetch_array()

mysql_fetch_assoc()

mysql_data_seek()

mysql_fetch_object()

mysql_fetch_lengths()

mysql_free_result()

<<PreviousNext>>