سؤال

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