$be=sql_fetch("SELECT cl_id,cl_date FROM {$g5['clap_table']} WHERE cl_cnt > 1 AND date_format(cl_date, '%Y-%m-%d') <= '{$last}' ORDER BY cl_date LIMIT 1");
if($be['cl_id']){
$last=date("Y-m-d",strtotime($be['cl_date']));
}
$sum=sql_fetch("SELECT sum(cl_cnt) as sum FROM {$g5['clap_table']} WHERE date_format(cl_date, '%Y-%m-%d') <= '{$last}'");