I cannot come up with a reasonable solution to this problem without resorting to ridiculous combinations of user-defined functions. Maybe you can provide some fresh thoughts on this.
I have the following (simplified) array
Array
(
[0] => Array
(
[vid_id] => 420037
[vid_rating] => 2.93827
[vid_quality] => 2
[vid_special] => 1
[vid_weight] => 0
[vid_position] => 0
[vid_position_end] => 0
)
[1] => Array
(
[vid_id] => 420040
[vid_rating] => 3
[vid_quality] => 1
[vid_special] => 1
[vid_weight] => 0
[vid_position] => 0
[vid_position_end] => 0
)
[2] => Array
(
[vid_id] => 426455
[vid_rating] => 3.25581
[vid_quality] => 2
[vid_special] => 0
[vid_weight] => 5
[vid_position] => 1
[vid_position_end] => 2
)
[3] => Array
(
[vid_id] => 429804
[vid_rating] => 3
[vid_quality] => 2
[vid_special] => 0
[vid_weight] => 0
[vid_position] => 0
[vid_position_end] => 0
)
[4] => Array
(
[vid_id] => 420848
[vid_rating] => 2.94444
[vid_quality] => 2
[vid_special] => 0
[vid_weight] => 3
[vid_position] => 1
[vid_position_end] => 2
)
[5] => Array
(
[vid_id] => 420859
[vid_rating] => 2.73077
[vid_quality] => 2
[vid_special] => 0
[vid_weight] => 4
[vid_position] => 1
[vid_position_end] => 2
)
[6] => Array
(
[vid_id] => 420524
[vid_rating] => 2.41379
[vid_quality] => 2
[vid_special] => 0
[vid_weight] => 5
[vid_position] => 2
[vid_position_end] => 2
)
[7] => Array
(
[vid_id] => 419810
[vid_rating] => 3.13393
[vid_quality] => 1
[vid_special] => 0
[vid_weight] => 0
[vid_position] => 0
[vid_position_end] => 0
)
[8] => Array
(
[vid_id] => 419851
[vid_rating] => 2.97802
[vid_quality] => 1
[vid_special] => 0
[vid_weight] => 5
[vid_position] => 1
[vid_position_end] => 2
)
[9] => Array
(
[vid_id] => 419843
[vid_rating] => 2.95349
[vid_quality] => 1
[vid_special] => 0
[vid_weight] => 3
[vid_position] => 1
[vid_position_end] => 2
)
[10] => Array
(
[vid_id] => 419838
[vid_rating] => 2.73529
[vid_quality] => 1
[vid_special] => 0
[vid_weight] => 4
[vid_position] => 1
[vid_position_end] => 2
)
)
This array is the result of this mysql query
SELECT
vid_id,
vid_rating,
vid_quality,
vid_special,
vid_weight,
vid_position,
vid_position_end
FROM versions
WHERE vid_movid = 'xxxxx' AND vid_status = 1
ORDER BY vid_special DESC, vid_quality DESC, vid_rating DESC
This is a list of links to the website (the actual link column is removed for simplicity), which must be placed in a very specific order. Doing what I need to do is possible with a few UNIONed queries .... but I really don't want to resort to this, as the cost will be very high, so I decided that manipulating arrays would be easier.
.
, vid_position,
vid_position_end ,
. ,
, 2
,
1-2. 1-3, 3
.
,
.
5 , 5
1-2,
2
. 3
, .
.
1-2,
3-3.
2 ,
3 .
,
1 .
.
1-2
, 3-3,
, 3-3
.
user15063