I have a PHP script that executes a MySQL SELECT query, and I would like to echo each row from that query to the page. I have tried multiple methods to go about doing this, but none seems to work. The most reasonable of these ways that I have come up with is provided below, but it doesn't work either.
$result = $conn->query("SELECT count FROM countTable;") or trigger_error($conn->error);
$row = $result->fetch_array(MYSQL_BOTH);
$count = sizeof($row);
for($i = 0; $i <= $count; $i++)
{
echo $row[$i];
}
The code provided above only prints the first row resulting form the query. How can I modify this code so that it prints the entirething?
fetch_array()only get 1 row -Fetch a result row as an associative, a numeric array, or both