I have an array with as set of users and their respective karma:
$some_array = Array
(
[user_id] => Array
(
[0] => 4
[1] => 3
[2] => 5
[3] => 1
)
[karma] => Array
(
[0] => 129
[1] => 87
[2] => 13
[3] => 20
)
)
I was wondering if, when you are retrieving the user data from a MySQL table, you can add an extra column with the karma array and order by that extra_column:
$query = 'SELECT user.*, {{$some_array['karma'] as extra_column}} WHERE
user.id IN '.(implode(',',$some_array['user_id'])).' ORDER BY extra_column';
Any ideas? Is it possible?