Merging Tables - A Practical Concept?

13 posts by 6 authors in: Forums > CMS Builder
Last Post: February 20, 2011   (RSS)

shuffle($carouselRecords);


my field name in different sections calls "date", how to sort the records by date instead of shuffle?

Re: [videopixel] Merging Tables - A Practical Concept?

By Chris - February 20, 2011

Hi videopixel,

You can sort an array of records by one of their fields like this:

// sort alphabetically and in reverse by 'date' field
function compare_date($a, $b) {
return strnatcmp($b['date'], $a['date']);
}

usort($carouselRecords, 'compare_date');


Does that help? Please let me know if you have any questions.
All the best,
Chris