I have a query which gets all records ordered by last_name. Now I would like to create a loop that groups these results by the first letter of the last name and display the
In your view you could then loop the records and split them up:
$current = ''; foreach ($rows as $r) { if (!$current || strtolower($r['name'][0]) != $current) { $current = strtolower($r['name'][0]); echo strtoupper($current).'---------------'; } echo $row['name'].''; }