Lamez Posted January 13, 2008 Share Posted January 13, 2008 Hi guys, On my message board it is suppose to post the new topic at top, well it does that, but then when there is about two more it starts posting the topics in the middle of the board, I am not too sure why. here is how it orders: $getthreads="SELECT * from forum where parentid='0' order by lastrepliedto ASC"; here is the whole code: <?php include "connect.php"; //mysql db connection here print '<div class="box">'; if($session->logged_in){ print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<p align='right'><A href='post.php'><img src='img/topic.png' border='0' alt='New Topic' /></a><br></p>"; print "<table class='maintable'>"; print "<tr class='headline'><td width=50%>Topic</td><td width=20%>Topic Starter</td><td>Replies</td><td>Last replied time</td></tr>"; $getthreads="SELECT * from forum where parentid='0' order by lastrepliedto ASC"; $getthreads2=mysql_query($getthreads) or die("Could not get threads"); while($getthreads3=mysql_fetch_array($getthreads2)) { $getthreads3[title]=strip_tags($getthreads3[title]); $getthreads3[author]=strip_tags($getthreads3[author]); print "<tr class='mainrow'><td><A href='message.php?id=$getthreads3[postid]'>$getthreads3[title]</a>"; print "</td><td align='center' valign='middle'><a href='../userinfo.php?user=$getthreads3[author]'>$getthreads3[author]</a></td><td align='center' valign='middle'>$getthreads3[numreplies]</td><td>$getthreads3[showtime]<br>Last post by <b><a href='../userinfo.php?user=$getthreads3[lastposter]'>$getthreads3[lastposter]</a></b></td></tr>"; } print "</table>"; print "<p align='right'><A href='post.php'><img src='img/topic.png' border='0' alt='New Topic' /></a><br></p>"; }else{ include ("../../style/include/cons/member.php"); } print '</div>'; include ("../../style/include/cons/foot.php"); ?> does anyone see where my problem is? Thanks guys! Quote Link to comment Share on other sites More sharing options...
trq Posted January 13, 2008 Share Posted January 13, 2008 Use DESC instead of ASC. Quote Link to comment Share on other sites More sharing options...
revraz Posted January 13, 2008 Share Posted January 13, 2008 Also, give an example of what is in lastrepliedto if that doesn't help. Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 13, 2008 Author Share Posted January 13, 2008 when I sort by DESC, the new post are at the bottom and in lastrepliedto: lastrepliedto='$thedate' and thedate is: $thedate=date("U"); //get unix timestamp $displaytime=date("F j, Y, g:i a"); Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 14, 2008 Author Share Posted January 14, 2008 any help? should I post the rest of the scripts? Quote Link to comment Share on other sites More sharing options...
revraz Posted January 14, 2008 Share Posted January 14, 2008 Copy and paste some actual values stored in lastrepliedto field. Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 14, 2008 Author Share Posted January 14, 2008 like from the message board? the output of lastrepliedto? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.