コード例 #1
0
ファイル: NIW_Controller.php プロジェクト: hungnv0789/vhtm
 function addVisiting()
 {
     if (!isset($_SESSION['isOldVisiting'])) {
         $model = new CI_Model();
         $today = date('Y-m-d', time() + 7 * 3600);
         if ($model->getRowByColumn('thongke', 'ngaythang', $today)) {
             $currentVisitingNumber = $model->getRowByColumn('thongke', 'ngaythang', $today)->soluong;
             $currentVisitingNumber += 1;
             $input = array('ngaythang' => $today, 'soluong' => $currentVisitingNumber);
             $model->updateRowByColumn('thongke', 'ngaythang', $today, $input);
         } else {
             $input = array('ngaythang' => $today, 'soluong' => 1);
             $model->insertNewRow('thongke', $input);
         }
         $_SESSION['isOldVisiting'] = 'true';
     }
 }