Grouping results of a recordset
I'm using DA2.0.6 developing a php / MySQL site and have a recordset that pulls a list of locations from a clients list of places where they have depots:
SELECT DISTINCT tbldepots.depotName
FROM tbldepots
ORDER BY tbldepots.depotName
but now want to group and display those records in alphabetical blocks under separate tabs (in a spry tabbed panel section of the page) so all "A*" locations are under the A tab, Bs under B etc.
Currently the repeat region on the page contains all of the records A-Z in a standard do...while loop:
<?php do { ?>
<li><?php echo $row_rsDepots['depotName']; ?></li>
<?php } while ($row_rsDepots = mysql_fetch_assoc($rsDepots)); ?>
I've tried experimenting with strpos etc:
if (strpos($row_rsDepots['depotName'], "a") ===0) {
echo $row_rsDepots['depotName']; }
But am not quite getting it how I think it should be! Am I missing something so obvious at the moment? (can't see the wood for the trees syndrome!!)
Any ideas as to how I can do this without having to run separate recordsets with a WHERE clause to pick out the individual letters?