Drop Shadow


By default, rows are displayed in reverse order by ID (this will usually show the most recent entries first). You can also specify a list of fields to order the rows by:

<? $searchFields = array('name', 'subject'); $searchRestrictions = array('city'=>'San Diego'); $db->order($searchFields); $db->where($searchFields, $searchRestrictions); $db->display(); ?>

Descending order

Normally, when you specify a field or field list for the sort order, each field is ordered in ascending order: smallest, lowest, or oldest items first. If you need descending order, you’ll need to give each item a direction:

<? $db->order(array('timequeued'=>'DESC', 'title')); ?>

Special sort options

The plug-in handles sorting for you: each column is linked to a sort based on that column. Sometimes, however, you’ll want to tie a column to a more complex sort. For example, you might have a “name” column, that you want sorted by a “last_name” field first and then by “name”.

<? $db->setFieldSort('name', array('last_name', 'name')); ?>

Whenever someone chooses the “name” column, the data will be sorted by last_name and then by name.