fetch_one("SELECT cid, views, comments, model FROM $system_main_table WHERE id = '$id'"); $data or exit(''); $model_main_table = $db_config['table_prefix'].'cms_item_'.$data['model'].'_'; if( $DB_master->update( $system_main_table, array('views' => 'views +1'), "id = '$id'", false ) ){ $DB_master->update( $model_main_table, array('views' => 'views +1'), "id = '$id' ", false ); $cid = $data['cid']; $today = mktime(0,0,0,date('m'),date('d'),date('Y')); $ret = $DB_master->update( $statistic_views, array('count' => 'count +1'), "cid = '$cid' and timestamp = '$today'", false ); if(!$ret){ $DB_master->insert( $statistic_views, array('cid'=> $cid, 'timestamp'=> $today, 'count' => 1) ); } } exit(' $(function(){ $(\'.item_views\').html('. $data['views'] .'); $(\'.item_comments\').html('. $data['comments'] .'); }); ');