skip to content

 Web design 

Database-driven systems

Easy-to-maintain web sites


 



What's New

Array Sort Setup Module Released

Posted by Chris (chris) on Aug 01 2008
What's New >>

Array_Rows_to_Columns
This is a short routine to make a 2 dimensional array sortable by up to 6 fields (using the array_multisort command). My main purpose in writing this module was to make it quick and simple to sort an array and avoid poring through the help file each time to figure it out. Before I put this together, I downloaded and tested a couple of array sort routines and couldn't get them to work for my array. The key problem is that the most common array structure has a primary key / dimension (that is often used as an index number) and a secondary array containing fields within each primary index entry. This looks like:

   $test_array[0]['first_name']
   $test_array[0]['last_name']

This does not lend itself to sorting on anything other than the primary key / index. There is a way to get around this so we can use fields such as first_name and last_name in the above example as sort fields. The module that I have developed simplifies the setup to do this.

 

 

Last changed: Aug 01 2008 at 11:54 AM

Back
 
   

Powered by Website Baker,
Design by Innovations Design based on a template by gavjof