Jump to content

Sorting of data


karvenki12

Recommended Posts

Hi,

 

I am trying to figure out how to sort my data either in ASC or DESC order. I tried using set::sort method, paginator:sort method, but not able to find a solution for this. The code that I am currently working on is pasted below. I need to sort the members data by their lastname. I would really appreciate if someone can help me with this.

 

Thank you,

 

 

<div class="members view">

<h2><?php __('Members associated with <b>'.$programs['Program']['name'].'</b>')?></h2>

<table cellpadding="0" cellspacing="0">

<tr>

<th>No</th>

<th>Member</th>

</tr>

<?php

$i = 0;

foreach ($members as $member):

$class = null;

if ($i++ % 2 == 0) {

$class = ' class="altrow"';

                   

}

?>

tr<?php echo $class?>>

<td><?=$i?></td>

<td><?=$member['Member']['lastname']?>, <?=$member['Member']['firstname']?>  <small><i>(<?=$member['Member']['publication_name']?>)</i></small></td>

 

</tr><

 

<?php endforeach; ?>

</table>

</div>

Link to comment
https://forums.phpfreaks.com/topic/228679-sorting-of-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.