Ok, I hope I understood it now.
You'll have to fetch all mysql results into an array and use a loop to iterate over them.
Example, assuming you're using the ubb.threads functions:
// do the query
$sth = $dbh -> do_query($query);
// get the number of returned to know when you've to stop the loop
$rows = $dbh -> total_rows($sth);
// start the loop, do it until max rows is reached
for ($i=0;$i < $rows ;$i++){
list ($yourvalue,$secondvalue) = $dbh -> fetch_array($sth);
if ($i < ($rows / 2)) {
// do something with the values
}
else {
// do something else
}
}
You can change the if condition to anything else.
Note that are many ways to do it. Look at the user comments at
http://de3.php.net/manual/de/function.mysql-fetch-array.php for different variants.