我尝试在我的数组中获取元素的位置,但这不起作用,这是我的代码:
<?php
function getWorldRank(){
$query = ("SELECT nickname FROM users ORDER BY score, updateDate Desc ");
mysql_query("SET NAMES 'utf8'");
//GOES TO THE DB WITH THE QUERY
$result = mysql_query($query);
//CHECKS IF THE QUERY IS LEGAL
if(!$result)
return false;
//CHECKS IF THERE ARE NO ROWS FOUND IN THE TABLE
if(mysql_num_rows($result)==0)
return false;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$returned_array[] = $row;
}
return $returned_array;
}
$a=getWorldRank();
echo $key = array_search('vvvv', $a);
echo $key = array_search('bbbb', $a);
?>