$query = mysql_query("SELECT col1,col2,col3 FROM my_table WHERE ... LIMIT 5"); while($record = mysql_fetch_object($query)) { list_my_records(); } ... some other code ... while($record2 = mysql_fetch_object($query)) { use_another_format_to_list_records(); }