Independent
26-06-2008, 07:49 PM
How do you make PHP show only 20 of the newest fields on the page, but still able to check which username the comment is for, the current code is;
if($_POST[comment]) {
$message = silence($_POST['little']);
mysql_query("INSERT INTO comments (`from`, `for`, `message`, `date`) VALUES('$nivusr', '$propername', '$message', '$time')") or die(mysql_error());
print("<br /><br /><b>Your comment has been added.. please wait a couple of seconds!</b><meta http-equiv=\"refresh\" content=\"1\"/>");
}
}
else {
while($showcomments = mysql_fetch_array($commentcheck)) {
$commentfrom = ($showcomments['from']);
$commentmessage = ($showcomments['message']);
$commentdate = ($showcomments['date']);
$getmyfriendsimg = mysql_query("SELECT * FROM profile WHERE `name` = '$commentfrom' ORDER BY `id`");
while($showmyfriendsimg = mysql_fetch_array($getmyfriendsimg)) {
$shiwmymatesava = ($showmyfriendsimg['myimg']);
$shiwmymatename = ($showmyfriendsimg['name']);
echo('<table width="800" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td valign="top" width="50" height="1"><a href="http://www.nivade.com/profile/'.$commentfrom.'"><img border="0" img width="50" height="50" src="'.$shiwmymatesava.'"></a></td>
<td valign="top" width="700" height="12"><a href="http://www.nivade.com/profile/'.$commentfrom.'">'.$commentfrom.'</a></b><br /><font color="'.$fontcolor.'" face="'.$font.'">'.$commentmessage.'<br /></td>
</tr>
</table><br />');
}
if($_POST[comment]) {
$message = silence($_POST['little']);
mysql_query("INSERT INTO comments (`from`, `for`, `message`, `date`) VALUES('$nivusr', '$propername', '$message', '$time')") or die(mysql_error());
print("<br /><br /><b>Your comment has been added.. please wait a couple of seconds!</b><meta http-equiv=\"refresh\" content=\"1\"/>");
}
}
else {
while($showcomments = mysql_fetch_array($commentcheck)) {
$commentfrom = ($showcomments['from']);
$commentmessage = ($showcomments['message']);
$commentdate = ($showcomments['date']);
$getmyfriendsimg = mysql_query("SELECT * FROM profile WHERE `name` = '$commentfrom' ORDER BY `id`");
while($showmyfriendsimg = mysql_fetch_array($getmyfriendsimg)) {
$shiwmymatesava = ($showmyfriendsimg['myimg']);
$shiwmymatename = ($showmyfriendsimg['name']);
echo('<table width="800" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td valign="top" width="50" height="1"><a href="http://www.nivade.com/profile/'.$commentfrom.'"><img border="0" img width="50" height="50" src="'.$shiwmymatesava.'"></a></td>
<td valign="top" width="700" height="12"><a href="http://www.nivade.com/profile/'.$commentfrom.'">'.$commentfrom.'</a></b><br /><font color="'.$fontcolor.'" face="'.$font.'">'.$commentmessage.'<br /></td>
</tr>
</table><br />');
}