php + mysql_num_rows

Unic

New Member
is there a more efficient way of doing the following?\[code\]$total_a = mysql_query("SELECT `id` FROM `table` WHERE `this` = 'that'");$total_b = mysql_num_rows($total_a);if(!$total_b){ echo 'no results';}else{ $a = mysql_query("SELECT `id`, `time` FROM `table` WHERE `this` = 'that' ORDER BY `time` DESC"); while($b = mysql_fetch_assoc($a)) { echo $b['id'].'-'.$b['time'].'<br />'; }}\[/code\]there is no other way around than using two queries for this, is there?
 
Back
Top