The miles are being caluculated during the loop that is created using the recordset not in the database.
First I create a do..while loop to get the miles do { $k = 0; //SET FIRST ARRAY OF ONLINE USERS AND CALCULATE MILES do { //GEOZIP $zip2 = $row_rsUSERIDID['zip']; $coor1=mycoors($zip1); $coor2=mycoors($zip2); $line1=split("\|",$coor1); $line2=split("\|",$coor2); $totaldist=distance($line1[0],$line1[1],$line2[0],$line2[1],"mi"); //SET NEW ARRAY WITH MILES $z['username'][$k] = $row_rsUSERIDID['uname']; $z['distance'][$k++] = $totaldist; } while ($row_rsUSERIDID = mysql_fetch_assoc($rsUSERIDID)); //SET NEW ARRAY $z['user'] = $z['username']; //SORT BY DISTANCES natsort ($z['distance']); reset ($z['distance']); //DISPLAY USER INFORMATION SORTED BY MILES foreach($z['distance'] as $k => $v){ $newuser = $z['user'][$k]; echo $newuser . " - " . $v . "<br>"; } } while ($row_rsUSERIDID = mysql_fetch_assoc($rsUSERIDID)); I now what to display this info 10 records at a time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php