Jump to content

do i need 2 queries just for an ORDER BY change?


RCB

Recommended Posts

 

 

hey guys i was just wondering if  i have to make 2 separate queries to get basically the same info just display in a different order... can i do it with 1 query?

 

the first 1 would be

 

 

ORDER BY added DESC

 

second would be

 

ORDER BY rand()

 

thx

 

 

 

 

 

 

maybe

<?php
$result = mysql_query("SELECT ... ORDER BY added DDESC");
$order = range(0, mysql_num_rows($result));
foreach ($order as $i){
echo mysql_result($result, $i, 'field name');
// etc.
}
shuffle($order);
foreach ($order as $i){
echo mysql_result($result, $i, 'field name');
// etc.
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.