What I want to do is output the first 5 records of 10 from a database query and then modify the output slightly for the next 5. What's the best way to do it? At the moment, I've got:

PHP Code:
   if(is_array($var)) {
       foreach (
$var as $v) {
          
// do stuff
          
}

$var is created from the database query. Can I do this using the same query and modifying the loop or do I need two separate queries?