0
我需要將查詢的結果分爲3個集羣:第1-3行,第4-6行,第7-9行,並將它們放入變量return1,return2,return3和。我該如何有效地做到這一點?將查詢結果拆分爲3個集羣
$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;