每8个td排成一行且想邻不同月分用颜色隔开
$rs = $db->query($sql)->fetchAll(PDO::FETCH_ASSOC);
$aLen= count($rs);
$i = 0;
$t = '';
if($aLen > 0){
$strList = '<tr>';
foreach($rs as $kk => $v){
$i += 1;
if($kk ==0){
$stradddate = date('Y-m-d',strtotime('+1 day', strtotime($v['f_date'])));
}
$m = ' class="time"';
if($t != substr($v['f_date'],1,7)){
$m = ' class="title" style="background:#aaa;"';
}
$strList .= '<td '.$m.'>'.($iTotalRecord - ($p -1) * $iPagesize - $kk).'、'.$v['f_date'].'</td>';
//$a = '<a href="?k='.$k.'&did='.$did.'&p='.$p.'&act=OutcomeModify&id='.$v['f_id'].'#abc">修改</a>';
//$strList .= '<td class="operate">'.$a.'</td></tr>';
if(($i % 8 == 0) && ($i < $aLen) && ($i >=2)) $strList .= '</tr><tr>';
if(($i == ($aLen)) && ($aLen >=2)) $strList .='</tr>';
if(($i == 1) && ($aLen == 1)) $strList .='</tr>';
$t = substr($v['f_date'],1,7);
}
}
$aLen= count($rs);
$i = 0;
$t = '';
if($aLen > 0){
$strList = '<tr>';
foreach($rs as $kk => $v){
$i += 1;
if($kk ==0){
$stradddate = date('Y-m-d',strtotime('+1 day', strtotime($v['f_date'])));
}
$m = ' class="time"';
if($t != substr($v['f_date'],1,7)){
$m = ' class="title" style="background:#aaa;"';
}
$strList .= '<td '.$m.'>'.($iTotalRecord - ($p -1) * $iPagesize - $kk).'、'.$v['f_date'].'</td>';
//$a = '<a href="?k='.$k.'&did='.$did.'&p='.$p.'&act=OutcomeModify&id='.$v['f_id'].'#abc">修改</a>';
//$strList .= '<td class="operate">'.$a.'</td></tr>';
if(($i % 8 == 0) && ($i < $aLen) && ($i >=2)) $strList .= '</tr><tr>';
if(($i == ($aLen)) && ($aLen >=2)) $strList .='</tr>';
if(($i == 1) && ($aLen == 1)) $strList .='</tr>';
$t = substr($v['f_date'],1,7);
}
}