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


?>
Was it helpful?

Solution

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

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
scroll top