Re: [PHP] Arrays and Alphabetical order

2003-07-22 Thread Evan Nemerson
/* UNTESTED - and prolly could be more efficient */ $c = $d = ''; natsort($info); foreach ( $info as $i ) { $d = substr($i, 0, 1); if ( $d != $c ) echo "\n"; echo $i; $c = $d; } On Tuesday 22 July 2003 09:40 am, Don Mc Nair wrote: > Hi folks > > I a

Re: [PHP] Arrays and Alphabetical order

2003-07-22 Thread Liam Gibbs
<> Do a query, sorting by the field you need alphabetized. Then do this (and tidy it up as you need): echo ""; while($result = mysql_fetch_row$(query)) { if(substr($result, 0, 1) != $previousfirstletter) { $previousfirstletter = substr($result, 0, 1); echo "$previousfirstletter";

Re: [PHP] Arrays and Alphabetical order

2003-07-22 Thread David Nicholson
Hello, This is a reply to an e-mail that you wrote on Tue, 22 Jul 2003 at 17:40, lines prefixed by '>' were originally written by you. > I need it to echo > out a > table with all the A's first, then a blank line, then all the B's, a > blank > line and so on. I could write 26 different queries, on