Well... i'll make 2 functions. 1st function is to display all list people and the 2nd function is to sort list of people that start from Online people to offline people. Here is my code:
1st function :
function contactList($userID) {
$val;
$i = 0;
//get peoplelist
$sql= "select FRIEND_NAME, STATUS from CONTACTLIST where ID='$userID' order by FRIEND_NAME;
$result = mysql_query($sql)
while($myrow = mysql_fetch_row($result)){
$contactName=$myrow[0];
$contactStatus=$myrow[1];
$val[$i][0] = $contactName;/lis people
$val[$i][1] = $contactStatus;/ online/offline
$i++;
}
return $val;
}
Above function is work correctly, for example it will display like :
FRIEND_NAME | STATUS |
Joni | online |
Michael | offline|
Steven | offline|
Tony | online |
My problem is how to make 2nd function (to sort above list) so it will display like this (start from online to offline)
FRIEND_NAME | STATUS |
Joni | online |
Tony | online |
Michael | offline|
Steven | offline|