我正在从数据库中获取我的数组值。它只是用户的名字。我在检索它们时打印它们,我想按它们名称的字母顺序打印它们(升序)。我怎样才能做到这一点 ?
foreach($common_follows as $row) // $common_follows contains the IDs of users
{
$names=$obj2->get_user_name($row); //this function gets the name from user ID
while ($rows = mysql_fetch_assoc($names)) // For getting the name of the person being followed
{
sort($rows['name']); //Not seems to sort
echo '<img src="https://graph.facebook.com/'.$rows['user_id'].'/picture?type=normal" width="65" height="20" id="fbthumb">';
echo $rows['name']."<br>";
$count_common++;
}
}
该排序函数似乎不起作用,因为在每次循环迭代中都会返回一个名称。