Нибойса
<?php
$k_f = mysql_result(mysql_query("SELECT COUNT(id) FROM `frends_new` WHERE `to` = '$ank[id]' LIMIT 1"
, 0);
$k_fr = mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"
, 0);
$res = mysql_query("select `frend` from `frends` WHERE `user` = '$ank[id]' AND `i` = '1'"
;
$i = 0;
while ($k_fr = mysql_fetch_array($res))
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$k_fr[frend]' && `date_last` > '".(time()-600)."'"
,0) != 0)
$i++;
}
echo '<a class="nav2" style="display: block;" href="/user/frends/?id='.$ank['id'].'"><img src="/style/icons/druzya.png" alt="*" /> Друзья ('.$k_fr.'/'.$i.')</a>';
if ($k_f>0 && $ank['id'] == $user['id'])echo '<a class="nav1" style="display: block;" href="/user/frends/new.php">Заявки в друзья (+'.$k_f.')</a>';
?>