PHP mysqli_fetch_row() Function

PHP mysqli_fetch_row() function fetches one row of data from the result set and returns it as an enumerated array.

Syntax

array mysqli_fetch_row(result);

mysqli_fetch_row() Function Parameter

ParameterDescription
result :Required parameter. Mention a result set identifier returned by mysqli_query().

mysqli_fetch_row() Function Return Value

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

mysqli_fetch_row() Function Example

<?php
$con = mysqli_fetch_rowt("localhost","user","password","db");

if (mysqli_connect_errno())
{
	echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$sql = "SELECT fname, lname FROM employee";
$sql_result = mysqli_query($con, $sql);

while ($row = mysqli_fetch_row($sql_result))
{
 echo $row[0] . " " . $row[1];
}
	
mysql_free_result($sql_result);

mysqli_close($con);
?>