hey guys i have a small problem with last 10 viewers in profile list..
i have this code in list:
and this code in profile view:
my problem is: If USER A visit my profile 10 times i show him 10 times in this list.
how i can have the most recent viewer by the USER A in only 1 result and not in all 10?
Thanks for help
i have this code in list:
PHP Code:
echo "<p class="secd"><u>$whonick - My Profile Viewers:</u>\n";
echo "<br/>";
echo "</div>";
echo "<p align="center">";
//////ALL LISTS SCRIPT <<
if($page=="" || $page<=0)$page=1;
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_lastview WHERE whonick='".$who."'")); //changable
$num_items = $noi[0];
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
$sql = "SELECT lastview,ltime FROM ibwf_lastview WHERE whonick='".$who."'ORDER BY ltime DESC LIMIT $limit_start, $items_per_page ";
echo "<div>";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$snick = getnick_uid($item[0]);
if(isonline($item[0]))
{
$iml = "<img src="images/onl.gif" alt="+"/>";
}else{
$iml = "<img src="images/ofl.gif" alt="-"/>";
}
$lnk = "<a href="index.php?action=viewuser&sid=$sid&who=$item[0]">$snick</a><br/>";
$newtime =$item[1]+(0 *60 *60);
$dte = "".date("D d M y - h:i:s a",$newtime)."<br/>";
echo "$iml $lnk $dte<br/>";
}
}
PHP Code:
$lv=getuid_sid($sid);
$me = getuid_sid($sid);
if ($me != "$who")
{
mysql_query("INSERT INTO ibwf_lastview SET lastview='".$lv."', whonick='".$who."', ltime='".time()."'");
}
$sql= mysql_fetch_array(mysql_query("SELECT lastview,ltime FROM ibwf_lastview WHERE whonick='".$who."'ORDER BY ltime DESC LIMIT 1"));
$a = getuid_sid($sql[0]);
$tm = time();
$timeout = $tm - 86400; //time out = 1 day
mysql_query("DELETE FROM ibwf_lastview WHERE ltime <'".$timeout."'");
how i can have the most recent viewer by the USER A in only 1 result and not in all 10?
Thanks for help
Comment