Jump to content

[SOLVED] Limit number of what appears?


djfox

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.