RE: [PHP] Dispalying Arrays - Again

From: Date: Tue, 15 Apr 2003 01:01:15 +0000
Subject: RE: [PHP] Dispalying Arrays - Again
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-143854@lists.php.net to get a copy of this message
you're using a do{} while() loop...does the $row_rsUSERS data have anything in it at teh start of the loop because it will execute the do part once before it fetches from $rsUSERS. why asort each time as well? why not at the end? maybe i'm missing something... you should also use a foreach loop instead of the while (list each) construct...(better performance) In your final echo line, you have $z['distance'][$val] instead of $val1...typo maybe? jack > -----Original Message----- > From: Vernon [mailto:vernon@comp-wiz.com] > Sent: Monday, April 14, 2003 8:53 PM > To: php-general@lists.php.net > Subject: [PHP] Dispalying Arrays - Again > > > I'm trying to display the values of two arrays together and am having the > hardest time. > > //SET THE ARRAYS > do { > $z['username'][] = $row_rsUSERS['username']; > $z['distance'][] = $totaldist; > > //SORT > asort ($z['distance']); > reset ($z['distance']); > > } while ($row_rsUSERS = mysql_fetch_assoc($rsUSERS)); > > //OUTPUT > while (list ($key1, $val1) = each ($z['username'])) { > > //DISPLAY KEY AND VALUE OF USERNAMES > echo "$key1 = $val1<br>"; > > //THIS IS WHAT I'M THINK SHOULD DISPLAY VALUE OF BOTH > //DISPLAYS NOTHING THUS FAR > echo > $z['username'][$val1].",".$z['distance'][$val]."<BR>"; > } > > > Anyone, please? > > Thanks > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#143854) next »