我是php的初学者,但这是我的问题。我从数据库中获取了一个用数组填充的var div,但是不知何故它不显示第一行。你们当中有人可能会想到为什么吗?
$sqlposts = "SELECT * FROM `posts` ";
$result = $conn->query($sqlposts);
$row = $result->fetch_assoc();
$div = array();
$div[] = "<div>";
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()){
$div[] = "<br>" . "<br>" . "Email: " . $row["email"] . "<br>" .
"Titel: " . $row["titel"] . " <br> " . "Message: " .
$row["post"] .
"<br>" . "<form action='' method='post'>
<a href='adjust.php?action=delete&id=" . $row['ID'] . "'>
delete</a>
<a href='adjust.php?action=aanpassen&id=" . $row['ID'] ."'>
aanpassen</a>
</form>
<br>";
print_r($row);
}
} else {
echo "0 results";
}
$div[] = "</div>";