I need to separate the results of a query in 3 clusters: rows 1-3, rows 4-6, rows 7-9 and place them in variables return1, return2, return3 resp. How can I do that efficiently?
$numrows = mysql_num_rows($sResult1);
$return1 = '';
$return2 = '';
$return3 = '';
for ($i = 0; $i < $numrows; $i++) {
$row1 = mysql_fetch_array($sResult1);
$return1 .= '<a title="' . $row1['resort'] . ' @ ' . $row1['lud'] . '" class="item" href="/review/' . $row1['resort_us'] . '/' . $row1['cam_id'] . '"><img class="item__image" id="c' . $row1['cam_id'] . '" src="/xs1/' . $row1['cam_id'] . '.jpg" alt="' . $row1['resort'] . '" /><h2 class="item__title">' . $row1['resort'] . '</h2></a>';
}
echo $return1;