Wondering how I can do this with CodeIgniter?
Any help is greatly appreciated!
Thanks.
Wondering how I can do this with CodeIgniter?
Any help is greatly appreciated!
Thanks.
There's no built in function to do this. You'll have to loop through an sql query to do this...
Select * from table order by field asc
foreach ( $result as $thing ) {
if ( $thing['name'][0] != $first_letter) {
echo '<h2>' . $thing['name'][0] . '</h2>';
$first_letter = $thing['name'][0];
}
echo $result['thing'];
}
this is just a rough example...never echo html like that.
foreach ($query->result() as $row) { $columnByName[$row->letter][] = array($row->column_name,$row->column_link); } return $columnByName; }
//in controller call the model and pass the return array to view
in view
use css to decorate to get exact match as you are looking