好的,我的代码有问题,但我找不到问题所在。使用我的代码时出现此错误:
警告:array_multisort() [function.array-multisort]:第 1506 行 /home/sagesca1/public_html/hiscores/functions.ws 中的数组大小不一致
这是我的代码:
function findFriends($table){
include "mysql.ws";
$user = $_SESSION['username'];
$xptype = findType($table)."xp";
$query = mysql_query("SELECT u.* FROM friends uf inner join users u on uf.friend = u.username WHERE uf.user = '$user'") or die(mysql_error());
$myFriends = array();
$xpOrder = array();
WHILE($row = mysql_fetch_array($query)){
$count = count($row);
$friends = $row['username'];
$rank = findRank($friends, "$table");
$sql = mysql_query("SELECT * FROM skills WHERE playerName LIKE '$friends' ORDER BY '$xptype' DESC") or die(mysql_error());
while($skillsRow = mysql_fetch_array($sql)){
for ($i = 1; $i <= $count; $i++){
$myFriends[$friends] = array(
'xp' => $skillsRow[$xptype],
'lvl' => getLevelForXP($skillsRow[$xptype]),
'rank' => $rank,
);
$xpOrder[] = $skillsRow[$xptype];
}
array_multisort($xpOrder, SORT_NUMERIC, SORT_DESC, $myFriends);
unset($xpOrder);
foreach ($myFriends as $friend => $data){
if(dots($data['xp']) !=0){
echo '
<a name="'.$data['rank'].'"></a>
<a href="compare.ws?user1='.$friend.'" target="_self" class="row ">
<span class="columnRank">
<span>'.$data['rank'].'</span>
</span>
<span class="columnName">
<span>'.BBCode($friend).'</span>
</span>
<span class="columnLevel">
<span>'.$data['lvl'].'</span>
</span>
<span class="columnXp">
<span>'.dots($data['xp']).'</span>
</span>
</a>';
}
}
}
}
}
谁能帮我解决这个问题,如果您需要关于我的代码的任何其他方法,我很乐意将它添加到这个问题中。