<div class="container">
<?php
$result = mysql_query("SELECT * FROM posting ORDER BY id");
//foreach(fetch_users() as $users){
//echo '{$users}';
echo "<table border='0'>
<tr>
<th>UserName</th>
<th>Most Recent Post</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['usr'] . "</td>";
echo "<td>" . $row['post'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</div> quick question
-
rstinohio1
- Posts: 7
- Joined: Sun Dec 11, 2011 9:37 pm
- Location: USA - OHIO
quick question
i wrote this to display user posts on a news feed type page, how would i be able to display only users with something in the post row of my database?
Re: quick question
SELECT `columns`, `you`, `need` FROM `postings` WHERE `post_body` != '' ORDER BY `id`I guess would work.
Why would you have empty posts in the table at all though ?
-
rstinohio1
- Posts: 7
- Joined: Sun Dec 11, 2011 9:37 pm
- Location: USA - OHIO
Re: quick question
Its like a user status box, some of them have it left blank so i dont want to show them as having a new status if they dont have one. im going to try your code now.
-
rstinohio1
- Posts: 7
- Joined: Sun Dec 11, 2011 9:37 pm
- Location: USA - OHIO
Re: quick question
thanks, i got it to work, i dont know why your full code didnt work, so i had to play around a bit. thanks!
<div id="main">
<div class="container">
<?php
$result = mysql_query("SELECT * FROM posting WHERE `post` != '' ORDER BY id");
//foreach(fetch_users() as $users){
//echo '{$users}';
echo "<table border='0'>
<tr>
<th>UserName</th>
<th>Most Recent Post</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['usr'] . "</td>";
echo "<td>" . $row['post'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</div>
</body>
</html>