我在一个网站上工作,想显示用户的帖子。我知道如何在数据库和所有东西上创建行,但出于某种原因,它只是不加载任何东西
我在顶部有一个mysqli连接代码。
以下是PHP:
$sql = "SELECT MainPagePosts, PostUser FROM UserPosts";
$result = $mysqli->query($sql);
echo '<div class="UserPostsBox">';
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo '<p class="UserPost">'; $row["MainPagePosts"]; echo " | Posted By: "; $row["PostUser"]; echo"</p>";
}
echo '</div>';
} else {
echo "0 results";
}
$mysqli->close();
?>
她的CSS:
.UserPostsBox {
position: absolute;
z-index: 3;
top: 450px;
left: 480px;
width: 350px;
height: 550px;
border: 3px solid;
border-color: orange;
overflow-y: auto;
}
.UserPost {
color: #22262e;
font-size: 30px;
font-family: sans-serif;
z-index: 3;
width: auto;
height: auto;
position: relative;
top: auto;
bottom: auto;
left: auto;
overflow: auto;
border: 3px solid;
border-color: #22262e;
}
我试了很多,不知道该怎么办。
谢谢您
如果你想看网站,请点击这里
https://johnpowers.000webhostapp.com/JohnSite/HomePageItems/JohnSite_HomePage.html