array_multisort? http://php.net/manual/en/function.array-multisort.php hope that helps Zoltán Németh On cs, 2007-02-08 at 14:08 +0000, Dave Goodchild wrote: > Hi all. I am building an online events directory and as part of the system > users can search for events by date, category etc. > > The logic involved in finding events that match the user-entered dates works > like so: > > 1. we create a range of dates from the start and end dates specified by the > user > 2. we then poll the database for any events that encompass or intersect this > range (using the start_date and end_date fields from events table). > 3. we then find out the frequency of the event ie weekly, monthly and then > map out its lifetime. > 4. we then go through those dates, and for any that match a date in the user > range, the event on that date (ie all it details, name, venue, date, start > time etc) is added to an array. > > ...etc etc > > So we eventually have a large multidimensional array whose elements contain > arrays of events that fall on a specific date. > > I am using usort to ensure the events are sorted by date, but I also want to > sort by time, for instance if there are five events on one day I want to > sort them by start_time. > > Here's an example of how the event array looks: > > element [0] contains an array as follows ('date', 'name' venue', > 'start_time', 'category...'); > element [1] contains an array as follows ('date', 'name' venue', > 'start_time', 'category...'); > > I tried using array_multisort but it didn't seem to do what I wanted. I want > to sort by date, then start_time if the dates are equivalent. > > Any ideas? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php