I am grabbing data from the database, and sorting it in an array.
The data from the query (which is displayed in the proper order):
id task_id note date_created user_name document_name document_type
238 131 3g 1385563455 Admin doc3 jpg
238 131 3g 1385563455 Admin doc2 png
238 131 3g 1385563455 Admin doc1 png
240 131 sd 1385563536 Admin NULL NULL
241 131 sd 1385563565 Admin NULL NULL
242 131 qw 1385563612 Admin NULL NULL
I then grab the data and store it in an array:
$all_notes = array();
foreach($notes as $note) {
$all_notes[$note["id"]]["text"] = $note["note"];
$all_notes[$note["id"]]["user_name"] = $note["user_name"];
$all_notes[$note["id"]]["date"] = $note["date_created"];
$all_notes[$note["id"]]["task_id"] = $_POST['task_id'];
$all_notes[$note["id"]]["docs"]["document_name"][] = $note["document_name"];
$all_notes[$note["id"]]["docs"]["document_type"][] = $note["document_type"];
}
When I echo the $all_notes array, the sort order is now completely opposite. Instead of the first row of data being id 238, it is now 242. Even when I change the query to sort the opposite way, the array is still sorting the data from 238 to 242 (and not 242 to 238, which is what it should be).
Your help will be greatly appreciated!