Hi All, I am a php newbie, I am trying to create a site where users will register and enter their yahoo id. I want the users who are online on their yahoo messengers to show first on the list of users. Here is the code that will show if they are online or offline on yahoo. [code] <?php // Request Profile Info $result = @mysql_query("SELECT * FROM profile"); if (!$result) { echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } // Display the Content of the profile Table while ( $row = mysql_fetch_array($result) ) { $PrimaryYID = $row['PrimaryYID']; echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"3\" width=\"400\">"; $url = "http://mail.opi.yahoo.com/online?u=".$PrimaryYID."&m=t&t=0"; $handle = fopen ("$url", "r"); $contents = ""; do { $data = fread($handle, 10000); if (strlen($data) == 0) { break; } $contents .= $data; } while(true); fclose ($handle); if ((strpos(strtoupper($contents),"NOT ONLINE") ? strpos(strtoupper($contents),"NOT ONLINE")+1 : 0)>0) { $imgStatus = "<img src='ym/offline.gif' ALT='OFFLINE' border='0'>"; } else { $imgStatus = "<img src='ym/online.gif' ALT='ONLINE' border='0'>";} echo "<tr bgcolor=\"#eeeeee\"><td><b><a href=\"ymsgr:sendIM?$PrimaryYID\">$PrimaryYID</a></b></td><td align=\"center\"><a href=\"ymsgr:sendIM?$PrimaryYID\"> $imgStatus </a></td></tr>"; } echo "</table>"; ?> [/code] I dont know how I can make it that those who are online on their yahoo messenger to show first on the list. Please help me. Thanks in advance.