am having some serious problems wit my buddy list on my site. sometimes it takes long to load n other times it gives errors. can some1 help me? when i delete every1 buddies i notice that it loads up right away. plz help me
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>//////////////////////////////////Buddies
else if($action=="buds")
{
addonline(getuid_sid($sid),"Viewing My Buddies List","");
$uid = getuid_sid($sid);
$mybuds = getnbuds($uid);
$onbuds = getonbuds($uid);
echo "<card id=\"main\" title=\"Buddies $onbuds/$mybuds\">";
echo "<p align=\"center\">";
echo "Buddies: $onbuds/$mybuds
";
$unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".$uid."'"));
$pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'"));
$unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
if ($unreadinbox[0]>0)
{
echo "<a href=\"inbox.php?action=main&sid=$sid\">messag e box $umsg!</a>
";
}
$reqs = getnreqs($uid);
if($reqs>0)
{
echo "<a href=\"lists.php?action=reqs&sid=$sid\">$reqs new request!</a>
";
}
echo "<a href=\"index.php?action=chbmsg&sid=$sid\">";
echo "Your Mood</a>
";
echo parsemsg(getbudmsg($uid), $sid);
echo "
";
include("pop.php");
echo "
";
echo "</p>";
//////ALL LISTS SCRIPT <<
if($page=="" || $page<=0)$page=1;
$num_items = getnbuds($uid); //changable
$items_per_page= 5;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
/*
$sql = "SELECT
a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt FROM ibwf_users a
INNER JOIN ibwf_online b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid='".$uid."' OR b.tid='".$uid."') AND b.agreed='1' AND a.id!='".$uid."' GROUP BY 1,2
LIMIT $limit_start, $items_per_page
";
*/
$sql = "SELECT a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt FROM ibwf_users a INNER JOIN ibwf_buddies b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid='".$uid."' OR b.tid='".$uid."') AND b.agreed='1' AND a.id!='".$uid."' GROUP BY 1,2 ORDER BY a.lastact DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
if(isonline($item[2]))
{
$iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
//$iml = "[o]";
$uact = "";
$plc = mysql_fetch_array(mysql_query("SELECT place FROM ibwf_online WHERE userid='".$item[2]."'"));
$uact .= $plc[0];
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
//$iml = "[x]";
$uact = "Offline";
//$ladt = date("d m y-H:i:s", $item[0]);
//$ladt = Offline;
$uact .= $ladt;
}
$lnk = "<a href=\"index.php?action=viewbud&who=$item[2]&sid=$sid\">$iml $item[1]</a>";
echo "$lnk
";
echo "";
$bs = date("d m y-H:i:s",$item[5]);
//echo "Buddy since:$bs
";
echo "$uact
";
//echo "Says: ";
$bmsg = parsemsg(getbudmsg($item[2]), $sid);
if($bmsg[0]!="")
{
echo "[$bmsg]
";
}
echo "-----
";
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"lists.php?action=buds&page=$ppage&s id=$sid&view=$view\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"lists.php?action=buds&page=$npage&s id=$sid&view=$view\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"lists.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>
";
echo "<img src=\"http://besttop.mobi/c2.php?id=16727\" alt=\"\"/>";
echo "</p>";
echo "</card>";
}</div>
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>//////////////////////////////////Buddies
else if($action=="buds")
{
addonline(getuid_sid($sid),"Viewing My Buddies List","");
$uid = getuid_sid($sid);
$mybuds = getnbuds($uid);
$onbuds = getonbuds($uid);
echo "<card id=\"main\" title=\"Buddies $onbuds/$mybuds\">";
echo "<p align=\"center\">";
echo "Buddies: $onbuds/$mybuds
";
$unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".$uid."'"));
$pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'"));
$unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
if ($unreadinbox[0]>0)
{
echo "<a href=\"inbox.php?action=main&sid=$sid\">messag e box $umsg!</a>
";
}
$reqs = getnreqs($uid);
if($reqs>0)
{
echo "<a href=\"lists.php?action=reqs&sid=$sid\">$reqs new request!</a>
";
}
echo "<a href=\"index.php?action=chbmsg&sid=$sid\">";
echo "Your Mood</a>
";
echo parsemsg(getbudmsg($uid), $sid);
echo "
";
include("pop.php");
echo "
";
echo "</p>";
//////ALL LISTS SCRIPT <<
if($page=="" || $page<=0)$page=1;
$num_items = getnbuds($uid); //changable
$items_per_page= 5;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
//changable sql
/*
$sql = "SELECT
a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt FROM ibwf_users a
INNER JOIN ibwf_online b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid='".$uid."' OR b.tid='".$uid."') AND b.agreed='1' AND a.id!='".$uid."' GROUP BY 1,2
LIMIT $limit_start, $items_per_page
";
*/
$sql = "SELECT a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt FROM ibwf_users a INNER JOIN ibwf_buddies b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid='".$uid."' OR b.tid='".$uid."') AND b.agreed='1' AND a.id!='".$uid."' GROUP BY 1,2 ORDER BY a.lastact DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
if(isonline($item[2]))
{
$iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
//$iml = "[o]";
$uact = "";
$plc = mysql_fetch_array(mysql_query("SELECT place FROM ibwf_online WHERE userid='".$item[2]."'"));
$uact .= $plc[0];
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
//$iml = "[x]";
$uact = "Offline";
//$ladt = date("d m y-H:i:s", $item[0]);
//$ladt = Offline;
$uact .= $ladt;
}
$lnk = "<a href=\"index.php?action=viewbud&who=$item[2]&sid=$sid\">$iml $item[1]</a>";
echo "$lnk
";
echo "";
$bs = date("d m y-H:i:s",$item[5]);
//echo "Buddy since:$bs
";
echo "$uact
";
//echo "Says: ";
$bmsg = parsemsg(getbudmsg($item[2]), $sid);
if($bmsg[0]!="")
{
echo "[$bmsg]
";
}
echo "-----
";
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"lists.php?action=buds&page=$ppage&s id=$sid&view=$view\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"lists.php?action=buds&page=$npage&s id=$sid&view=$view\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"lists.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>
";
echo "<img src=\"http://besttop.mobi/c2.php?id=16727\" alt=\"\"/>";
echo "</p>";
echo "</card>";
}</div>

Comment