I'm working on a website and would like to display user posts. I know how to create the row on the database and everything but from some reason, it's just not loading anything.
I have a mysqli connect code at the top.
Here's the 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();
?>
Here's the 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;
}
I've tried lots of things and don't know what to do.
Thank You
Also if you want to see the website click here https://johnpowers.000webhostapp.com/JohnSite/HomePageItems/JohnSite_HomePage.html