Re: arrays() current() next() who to use

From: Date: Thu, 19 Aug 2004 22:49:29 +0000
Subject: Re: arrays() current() next() who to use
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-194293@lists.php.net to get a copy of this message
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.

« previous php.general (#194293) next »