scott.timlock Posted April 30, 2010 Share Posted April 30, 2010 $sql = "SELECT invoice_id, vehicle_id, type, date FROM invoice_haul WHERE date > ".$time; if ( !($result = $db->sql_query($sql)) ) { die('Error in obtaining haul data'); } while($haul = $db->sql_fetchrow($result)) { $row[] = $haul; } I cannot for the life of me figure out how to sort $row by the key $row[]['date'].... i know i can just ORDER BY the sql query but there are other queries that add to $row and i need to sort by the date after the fact. Quote Link to comment https://forums.phpfreaks.com/topic/200325-sorting-an-sql-query-array/ Share on other sites More sharing options...
khr2003 Posted May 2, 2010 Share Posted May 2, 2010 check out these php array sorting functions: http://www.php.net/manual/en/array.sorting.php I think you will need to use ksort() or krsort() depndes on what you need to accomplish Quote Link to comment https://forums.phpfreaks.com/topic/200325-sorting-an-sql-query-array/#findComment-1051920 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.