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);
Parameter | Description |
---|---|
result : | Required parameter. Mention a result set identifier returned by mysqli_query(). |
Return Values : | Returns an numerical array of strings that corresponds to the fetched row, or FALSE if there are no more rows. |
<?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); ?>