reverse order

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 4, 2014   (RSS)

By lynnzawie - August 1, 2014

I am trying to sort my listings on this page:  http://nysafah.org/jobs.php  I want the newest listing first so I used createdDate DESC in my sorting field.  This sorted them properly in cmsbuilder admin but they still appear reverse on page.  Is there somewhere else I should be adding the sorting info?

Hi Lynnawie,

What function are you using to retrieve your records from the section and display them on jobs.php? If you're using the getRecords function, you might have a custom orderBy statement in it:

  //Load the first wine record from my section
  list($wineRecord, $wineMetaData) = getRecords(array(
    'tableName'   => 'cars',
    'loadUploads' => true,
    'allowSearch' => false,
    'orderBy'     => 'createdDate ASC',
  ));

If this is the case, you'd just need to remove the the orderBy item from the getRecords array.

If you're using the mysql_select function, you might need to add the ORDER BY item to the where clause:

$results = mysql_select('cars',"`color` = 'blue' ORDER BY createdDate DESC"

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com