Hi all,
I’m making two queries and combining the results into an array and then trying to sort the array based on the timestamp as such:
$r = mysql_query(“SELECT * FROM table1”);
while ($a = mysql_fetch_assoc($r)) {
$fc[$a[‘timestamp’]][‘title’] = …
}
$r = mysql_query(“SELECT * FROM table2”);
while ($a = mysql_fetch_assoc($r)) {
$fc[$a[‘timestamp’]][‘title’] = …
}
So if the final array is something like this:
$fc[1111111111][‘title’] = ‘Dogs’;
$fc[3333333333][‘title’] = ‘Rabbits’;
$fc[2222222222][‘title’] = ‘Cats’;
I want the sorted array to look like this (SORT_DESC by timestamp):
$fc[3333333333][‘title’] = ‘Rabbits’;
$fc[2222222222][‘title’] = ‘Cats’;
$fc[1111111111][‘title’] = ‘Dogs’;
The problem is that array_multisort drops the key if it’s not string.
Any suggestions please?
Thanks