我正在尝试在无序列表的页面上显示数据库条目。我在我的 li 中呼应我的行,我的 sql 连接似乎很好......我不明白我哪里出错了......有人知道吗?
<body class="projects">
<?php
$mysqli = new mysqli("localhost", "root", "root", "project");
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
$query = "SELECT * FROM companies";
$result = $mysqli->query($query);
?>
<div id="projects" class="container">
<h1>Projects</h1>
<?php
while($row = $result->fetch_row());
?>
<ul>
<li>
<h2><?php echo $row['name']; ?></h2>
<p><?php echo $row['description']; ?></p>
</li>
</ul>
</div>
<?php
$result->close();
$mysqli->close();
?>
</body>