AbydosGater Posted December 4, 2006 Share Posted December 4, 2006 Hi, Im working on sort of a message board system for my website..I am using the following code to display the messages previously posted.[code]<?php echo "<br />"; $query = "SELECT * FROM sf_tenforward ORDER BY id DESC LIMIT 50"; $result = mysql_query($query) or die(mysql_error()); echo "<div align=\"center\"> "; while($post = mysql_fetch_array($result)) {$member_id = $post['member_id'];$author = mysql_query("SELECT * FROM sf_users WHERE member_id='$member_id'");$author = mysql_fetch_array($author);$arank = $author['rank'];$aname = $author['username'];$avatar = $author['avatar'];$CL = $author['CL'];$signature = $author['signature'];$timestamp = $post['timestamp'];$title = $post['title'];$content = $post['content'];$colour = $post['color'];if ($author['banned'] == 1){$banned = "<font color=red><i>User Banned</i></font><br>";}echo <<<POST<table width="100%" height="248" border="0" class='table_$colour'> <tr> <td width="14%" height="187" class='td_$colour'><div align="center"> <p><font color='white'><img src="images/$avatar" width="100" height="100"><br> Rank: $arank<br><br> User: $aname<br><br> Clearance level: $CL<br><br> $banned</p> </font></td> <td width="86%" class='td_$colour'><font color=white> <p><b><i>$title</i></b><br><br> $content</p></font> </td> </tr> <tr> <td class='td_$colour'><font color=white>$timestamp</font></td> <td class='td_$colour'><font color=white>$signature</font></td> </tr></table>POST;unset($banned);};?>And it seams to have worked for my first post ok..If you look i made a quick file just containg that code and dbconnection at www.shadowfleet.info/test.phpBut for the other two posts its not1) Displaying the double <br> after the post so the tables arnt on top of each other..And 2) Its moving the title of the last two posts down ages in the table, it should display it at the top of the table!Its working for the first post, any ideas why its not working for the rest?Thanks[/code] Link to comment https://forums.phpfreaks.com/topic/29443-grrr-my-message-board-while-loop-not-working-fully-aww/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.