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);


?>
有帮助吗?

解决方案

remove ; from while($row=mysqli_fetch_array($result));

其他提示

You must remove the ; from the while statement

while($row=mysqli_fetch_array($result)){
    echo "<br />";

    echo "ID : ". $row['id'];
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top