djfox Posted July 17, 2007 Share Posted July 17, 2007 Here`s what I have for my code: <? $res = mysql_query("SELECT subject,content,date,id,sender FROM artistcomment WHERE userID=$gall ORDER BY id DESC"); while($r = mysql_fetch_row($res) ) $comments[] = $r; if ($comments) foreach($comments as $c){ ?> <? $res = mysql_query("SELECT id, icon FROM userdata WHERE id='$c[4]'"); $comico = mysql_fetch_row($res); mysql_free_result($res); ?> <table border=0 width=100%> <tr> <td> <tr> <td> <table border=0 width=100% bgcolor="000000"> <tr><td bgcolor="312D37" colspan=2><a href="trancer.php?g=<? echo $c[4] ?>"><img src="<? echo "$comico[1]" ?>" border=0 height=50 width=50><a href="trancer.php?g=<? echo $c[4] ?>"><? echo $c[0] ?></a> Date: <? echo $c[2] ?> #<a href="comment.php?id=<? echo $c[3] ?>"><? echo $c[3] ?></a> <tr><td colspan=2 bgcolor="4A4553"><? echo $c[1] ?> </table> </table> <? } ?> How do tell the code to show just the latest 10 comments? At the moment it will list every single one. And, after a while that will be too much to scroll though. So how can I put the limit to 10? Link to comment https://forums.phpfreaks.com/topic/60299-solved-limit-number-of-what-appears/ Share on other sites More sharing options...
AndyB Posted July 17, 2007 Share Posted July 17, 2007 ... WHERE ....ORDER by ... LIMIT 10 Link to comment https://forums.phpfreaks.com/topic/60299-solved-limit-number-of-what-appears/#findComment-299968 Share on other sites More sharing options...
djfox Posted July 17, 2007 Author Share Posted July 17, 2007 Thank you very much! Link to comment https://forums.phpfreaks.com/topic/60299-solved-limit-number-of-what-appears/#findComment-299971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.