remove ;
from while($row=mysqli_fetch_array($result));
Data won't be fetched from database [closed]
Question
When attempting to pull in data from a mysql database, I'm getting nothing.
Just simply "ID: "
Code:
<?php
require 'db/connect.php';
$query = "SELECT * FROM offenses";
$result = mysqli_query($db, $query);
while($row=mysqli_fetch_array($result));{
echo "<br />";
echo "ID : ". $row['id'];
}
mysqli_close($db);
?>
Solution
OTHER TIPS
You must remove the ;
from the while statement
while($row=mysqli_fetch_array($result)){
echo "<br />";
echo "ID : ". $row['id'];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow