What Im wondering on, is there any way to sort a mysql query after serveral values, which might "interfer" with eachother (i.e. that one might overrule the others when beeing sorted) like you can with the php command array_multisort?

I have included the code I used to manage this with array_multisort and a little explanation of what I want to archive. If anyone knows if this is possible to do in only mysql it would be really nice to know how.

Thanks.

I.e. you have a bunch of articles that is submitted on the same day, some of those also have paid to be displayed above the other articles. The rest of the articles should be displayed after the time they was submitted.

Hence you got these values to sort by:
timestamp = exact time it got submitted.
date2 = 0000.00.00 i.e. the day it got submitted.
dist_plan_type = payment plan, goes from 1 (best) to 4 (free).

Iv tried several ways to solve this in a pure mysql query, but the timestamp ends up deciding the way they get picked up, and hence the articles is not displayed the right way.

PHP Code:
$query "select id, headline, summary, dist_plan_type, date2, timestamp from  ".$t_release." where enabled=1 order by date2 DESC, dist_plan_type ASC limit $s$num_rows_on_page";

$result MYSQL_QUERY($query);

$sort_array = array();

while(
$buffer mysql_fetch_assoc($result))
    {
    
$sort_array[] = array('date' => $buffer['date2'], 'type' => $buffer['dist_plan_type'], 'timestamp' => $buffer['timestamp'], 'id' => $buffer['id'], 'headline' => stripslashes($buffer['headline']), 'summary' => stripslashes($buffer['summary']));
    }

foreach (
$sort_array as $key => $value
    {
  
$date[$key] = $value['date'];
  
$timestamp[$key] = $value['timestamp'];
    
$type[$key] = $value['type'];
    }

array_multisort($dateSORT_DESC$typeSORT_ASC$timestampSORT_DESC$sort_array);

$total count($sort_array) - 1;

for (
$nr=0;$nr <= $total;++$nr)
    {
//echoes the result