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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.