CoderDan;10921946 wrote:The function appears to have a number of problems to me (and would throw errors on parse):
1) the $sql select"etc is not assigning a variable properly, ie $sql = "select etc
2) the function never runs the queries, or uses the results.
3) the function assigns the last 3 variables ($rows, $cols, $friends) and then stops - it doesn't do anything with them.
4) the function does not return anything, so calling it with:
echo( "".friends()."" );
(which should be:
echo friends();
)
will have no output anyway.
5) the query references $profile array variable, which is not passed to the function ($friends is, but it's not used)
ok i have changed it just can not show the out put any ideas
function getFriendNumber ( $IDp )
{
$sqlQuery = "SELECT COUNT(*) FROM friends WHERE ( addid='$rprofile[ID]' OR $rprofile[ID]' ) ANDacep`='1'";
return mysql_query($sqlQuery);
}
function showBlockFriends($IDp)
{
global $site;
$sFriendList = ShowFriendList( $profile -> _iProfileID, $profile -> aMutualFriends );
$iFriendNums = getFriendNumber( $profile -> _iProfileID );
if( $sfriends )
{
ob_start();
?>
<div class="clear_both"></div>
<?= $sfriends ?>
<div class="clear_both"></div>
<?
$ret = ob_get_clean();
$sFriendInfo = '<div class="caption_item"><a href="'.$site['url'].'viewFriends.php?iUser='.$addid -> _iProfileID.'">'.$iFriendNums.' '._t("_Friends").'</a></div>';
echo DesignBoxContent( _t( $sCaption ), $ret, 1, $sFriendInfo );
}
}
function ShowFriendList( $IDp, $aMutualFriends = 0 )
{
global $site;
global $max_thumb_width;
global $max_thumb_height;
if ($aMutualFriends == 0)
$aMutualFriends = array();
$id = (int)$id;
$friend_list_query = "SELECT `users`.* FROM `friends`
LEFT JOIN `users` ON (`users`.`ID` = `friends`.`addedid` AND `friends`.`addid` = '$id' OR `users`.`ID` = `friends`.`addid` AND `friends`.`addedid` = '$id')
WHERE (`friends`.`addedid` = '$id' OR `friends`.`addid` = '$id') AND `friends`.`acep` = '1' ORDER BY `users`.`Picture` DESC LIMIT 12";
$friend_list_res = mysql_query("$friend_list_query");
$iCounter = 0;
$ret = '';
while ( $friend_list_arr = mysql_query( $friend_list_res ) )
{
if (!array_key_exists($friend_list_arr['ID'], $aMutualFriends)){
$iCounter ++;
$sKey = '1';
if( $iCounter == 3 )
$sKey = '2';
$ret .= '<div class="friends_thumb_'.$sKey.'">' . get_member_thumbnail($friend_list_arr['ID'], 'none') . '<div class="browse_nick"><a href="' . getProfileLink($friend_list_arr['ID']) . '">' . $friend_list_arr['username'] . '</a></div><div class="clear_both"></div></div>';
if( $iCounter == 3)
$iCounter = 0;
}
}
return $ret;
}