문제

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