我使用的脚本显示数据库中的表格,但它一直给我这个错误:
有人请帮忙警告:mysqli_fetch_assoc()要求参数1为mysqli_result,第21行的C:\ xampp \ htdocs \ raynerblogger1 \ posts.php中给出布尔值
$sql = "SELECT * FROM blogs;";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
echo "<div id='message'>";
echo $row['author']; echo(':') . "<br>";
echo $row['post'] . "</div>" . "<br>" . "<br>" . "<br>";
}
答案 0 :(得分:0)
试试这个,我编辑了第1行和第6行:
$sql = "SELECT * FROM blogs";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
echo "<div id='message'>";
echo $row['author'].":". "<br>";
echo $row['post'] . "</div>" . "<br>" . "<br>" . "<br>";
}