Advertisement
cdsatrian

main controller

Aug 6th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.98 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit ('No direct script access allowed');
  2.  
  3.   /**
  4.    * @author Cahya DSN
  5.    * @email cahyadsn@gmail.com
  6.    * @link http://adzan.16mb..com
  7.    */
  8.  
  9. class Main extends CI_Controller {
  10.   private $actual_value=array();
  11.   private $variation=array();
  12.   private $num_of_data;
  13.   private $U=array();
  14.   private $u=array();
  15.   private $un=array();
  16.   private $sorted_un=array();
  17.   private $l,$d1,$d2,$max,$min;
  18.   private $highest_num=array();
  19.   private $u_s1=array();
  20.   private $u_sub1=array();
  21.   private $parameter1=array();
  22.   private $u_s2=array();
  23.   private $u_sub2=array();
  24.   private $parameter2=array();
  25.   private $u_s3=array();
  26.   private $u_sub3=array();
  27.   private $mean=array();
  28.   private $urut=array();
  29.   private $grup=array();
  30.   private $sum_of_mean=array();
  31.   private $forecast_value=array();
  32.   private $fer=array();
  33.   private $hasil=array();
  34.  
  35.   function __construct()
  36.   {
  37.     parent::__construct();
  38.     $this->load->model('forecast_model','_forecast');
  39.     list($this->actual_value,$this->variation,$this->num_of_data,$this->max,$this->min)=$this->_forecast->get_data_values();
  40.     $this->_public_view = $this->config->item('public_view');
  41.   }
  42.  
  43.   function index()
  44.   {
  45.     $data['title']="Stock Price Forecasting System";
  46.     $data['current'] = 'HOME';
  47.     $this->load->view('main/index',$data);
  48.   }
  49.  
  50.   function step1()
  51.   {
  52.     $this->load->helper('form');
  53.     $data['title']="Stock Price Forecasting System - Step 1";
  54.     $data['current']= 'PROCESS';
  55.     $data['actual_value']=$this->actual_value;
  56.     $data['num_of_data'] = $this->num_of_data;
  57.     $data['variation']= $this->variation;
  58.     $data['max'] = $this->max;
  59.     $data['min'] = $this->min;
  60.     $data['U']=$this->print_U();
  61.     $this->load->view('main/step1',$data);
  62.   }
  63.  
  64.   function step2_process($num_initial_interval)
  65.   {
  66.     $this->get_initial_length($num_initial_interval);
  67.     $this->get_initial_interval($num_initial_interval);
  68.     $this->get_interval_frequency($num_initial_interval);
  69.     $this->sorted_initial_interval();
  70.     $this->calculate_highest_freq($num_initial_interval);
  71.   }
  72.  
  73.   function step2()
  74.   {
  75.     $this->load->helper('form');
  76.     $data['current']='PROCESS';
  77.     $data['title']="Stock Price Forecasting System - Step 2";
  78.     $num_initial_interval=$this->input->post('num_initial_interval')?$this->input->post('num_initial_interval'):11;
  79.     $data['num_initial_interval']=$num_initial_interval;
  80.     $this->step2_process($num_initial_interval);
  81.     $data['length_initial_interval']=$this->print_initial_length($num_initial_interval);
  82.     $data['list_initial_interval']=$this->print_initial_interval($num_initial_interval);
  83.     $data['list_initial_interval_freq']=$this->print_interval_frequency($num_initial_interval);
  84.     $data['list_sorted_initial_interval']=$this->print_sorted_initial_interval();
  85.     $data['devided_1st']=$this->print_devided_1st();
  86.     $data['devided_2nd']=$this->print_devided_2nd();
  87.     $data['devided_3rd']=$this->print_devided_3rd();
  88.     $data['rebuild_interval']=$this->print_rebuild_interval($num_initial_interval);
  89.     $data['num_new_interval']=$this->get_num_new_interval();
  90.     $this->load->view('main/step2',$data);
  91.   }
  92.  
  93.   function step3_process($num_initial_interval)
  94.   {
  95.     $this->step2_process($num_initial_interval);
  96.     $this->devided_1st();
  97.     $this->devided_2nd();
  98.     $this->devided_3rd();
  99.     $this->rebuild_interval($num_initial_interval);
  100.   }
  101.  
  102.   function step3()
  103.   {
  104.     $this->load->helper('form');
  105.     $data['current']='PROCESS';
  106.     $data['title']="Stock Price Forecasting System - Step 3";
  107.     $num_initial_interval=$this->input->post('num_initial_interval')?$this->input->post('num_initial_interval'):11;;
  108.     $this->step3_process($num_initial_interval);
  109.     $data['list_of_fuzzy_sets']=$this->get_fuzzy_sets();
  110.     $data['fuzzification']=$this->get_fuzzification();
  111.     $data['flr']=$this->get_flr();
  112.     $data['flrg']=$this->print_flrg();
  113.     $data['forecast']=$this->print_forecast();
  114.     $this->save_forecast();
  115.     $data['fer']=$this->get_fer();
  116.     $data['afer']=$this->get_afer();
  117.     $this->load->view('main/step3',$data);
  118.   }
  119.  
  120.   function get_U()
  121.   {
  122.     $this->U['min']=floor($this->min);
  123.     $this->d1=$this->min-$this->U['min'];
  124.     $this->U['max']=ceil($this->max);
  125.     $this->d2=$this->U['max']-$this->max;
  126.   }
  127.  
  128.   function print_U()
  129.   {
  130.     $str='';
  131.     $this->get_U();
  132.     $str="U=[D<sub>min</sub> - d<sub>1</sub>,D<sub>max</sub> - d<sub>2</sub>]<br>U=[".$this->min." - ".$this->d1.",".$this->max." - ".$this->d2."]<br>U=[".$this->U['min'].",".$this->U['max']."]";
  133.     return $str;
  134.   }
  135.  
  136.   function get_initial_length($num_initial_interval)
  137.   {
  138.     $this->U['min']=floor($this->min);
  139.     $this->U['max']=ceil($this->max);
  140.     $this->l= ($this->U['max']-$this->U['min'])/$num_initial_interval;
  141.   }
  142.  
  143.   function print_initial_length($num_initial_interval)
  144.   {  
  145.     $str='';
  146.     $str.="l= (U<sub>max</sub>-U<sub>min</sub>)/n<br>" ;
  147.     $str.="l= (".$this->U['max']."-".($this->U['min']<0?"(".$this->U['min'].")":$this->U['min']).")/".$num_initial_interval."<br>" ;
  148.     $str.="l=".$this->l;
  149.     return $str;
  150.   }
  151.  
  152.   function get_initial_interval($num_initial_interval)
  153.   {
  154.     for($i=0;$i<$num_initial_interval;$i++){
  155.       $this->u[$i]['min']=($i==0?$this->U['min']:$this->u[$i-1]['max']);
  156.       $this->u[$i]['max']=$this->u[$i]['min']+$this->l;
  157.     }
  158.   }
  159.  
  160.   function print_initial_interval($num_initial_interval)
  161.   {
  162.     $str='';
  163.     for($i=0;$i<$num_initial_interval;$i++){
  164.       $str.= "u<sub>".($i+1)."</sub>=[".$this->u[$i]['min'].",".$this->u[$i]['max']."]<br>";
  165.     }
  166.     return $str;
  167.   }
  168.  
  169.   function get_interval_frequency($num_initial_interval)
  170.   {
  171.     for($i=0;$i<$this->num_of_data-1;$i++){
  172.       for($j=0;$j<$num_initial_interval;$j++){
  173.         if(!isset($this->un[$j])){
  174.           $this->un[$j]=array();
  175.           $this->un[$j][0]=0;
  176.           $this->un[$j][1]=$j+1;
  177.         }else{
  178.           $this->un[$j][0]+=($this->u[$j]['min']<=$this->variation[$i] && $this->variation[$i]<=$this->u[$j]['max'])?1:0;
  179.         }
  180.       }
  181.     }
  182.   }
  183.  
  184.   function print_interval_frequency($num_initial_interval)
  185.   {
  186.     $str='';
  187.     for($i=0;$i<$num_initial_interval;$i++){
  188.       $str.="A<sub>".$this->un[$i][1]."</sub>=".$this->un[$i][0]."<br>";
  189.     }
  190.     return $str;    
  191.   }
  192.  
  193.   function sorted_initial_interval()
  194.   {
  195.     $this->sorted_un=$this->un;
  196.     foreach ($this->sorted_un as $key => $row) {
  197.       $num[$key]  = $row[0];
  198.       $idx[$key] = $row[1];
  199.     }
  200.     array_multisort($num, SORT_DESC, $idx, SORT_ASC, $this->sorted_un);
  201.   }
  202.  
  203.   function print_sorted_initial_interval()
  204.   {
  205.     $str='';
  206.     foreach($this->sorted_un as $key=>$val){
  207.       $str.="A<sub>".$val[1]."</sub>=".$val[0]."<br>";
  208.     }
  209.     return $str;
  210.   }
  211.  
  212.   function calculate_highest_freq($num_initial_interval)
  213.   {
  214.     $c=0;
  215.     for($i=0;$i<$num_initial_interval;$i++){
  216.       if($i==0){
  217.         $this->highest_num[$c]=array();
  218.         $this->highest_num[$c][0]=$this->sorted_un[0][0];
  219.         $this->highest_num[$c][1]=$this->sorted_un[0][1];
  220.         $c++;
  221.         $d=1;
  222.       }else{
  223.         if($this->sorted_un[$i][0]==$this->highest_num[$c-1][0]){
  224.           $d++;
  225.           $this->highest_num[$c-1][$d]=$this->sorted_un[$i][1];
  226.         }else{
  227.           $this->highest_num[$c]=array();
  228.           $this->highest_num[$c][0]=$this->sorted_un[$i][0];
  229.           $this->highest_num[$c][1]=$this->sorted_un[$i][1];
  230.           $c++;
  231.           $d=1;
  232.         }
  233.       }
  234.     }
  235.   }
  236.  
  237.   function devided_1st()
  238.   {
  239.     $n_1st=count($this->highest_num[0]);
  240.     for($i=1;$i<$n_1st;$i++){
  241.       $u_max[$i-1]=$this->u[$this->highest_num[0][$i]-1]['max'];
  242.       $u_min[$i-1]=$this->u[$this->highest_num[0][$i]-1]['min'];
  243.       $u_l[$i-1]=($u_max[$i-1]-$u_min[$i-1])/4;
  244.       for($j=0;$j<4;$j++){
  245.         $this->u_sub1[$i][$j]['min']=($j==0?$u_min[$i-1]:$this->u_sub1[$i][$j-1]['max']);
  246.         $this->u_sub1[$i][$j]['max']=$this->u_sub1[$i][$j]['min']+$u_l[$i-1];
  247.       }
  248.       $this->u_s1=(isset($this->u_s1)?array_merge($this->u_s1,$this->u_sub1[$i]):$this->u_sub1[$i]);
  249.       unset($this->u[$this->highest_num[0][$i]-1]);
  250.     }
  251.     $this->parameter1=array($n_1st,$u_max,$u_min,$u_l);    
  252.   }
  253.  
  254.   function print_devided_1st()
  255.   {
  256.     $this->devided_1st();
  257.     $str='';
  258.     for($i=1;$i<$this->parameter1[0];$i++){
  259.       $str.="u<sub>".$this->highest_num[0][$i]."</sub>=[".$this->parameter1[2][$i-1].",".$this->parameter1[1][$i-1]."]<ul>";
  260.       for($j=0;$j<4;$j++){
  261.         $str.="<li>u<sub>".$this->highest_num[0][$i].",".($j+1)."</sub>=[".round($this->u_sub1[$i][$j]['min'],2).",".round($this->u_sub1[$i][$j]['max'],2)."]</li>";
  262.       }
  263.       $str.="</ul>";
  264.     }
  265.     return $str;    
  266.   }
  267.  
  268.   function devided_2nd()
  269.   {
  270.     $n_2nd=count($this->highest_num[1]);
  271.     for($i=1;$i<$n_2nd;$i++){
  272.       $u_max2[$i-1]=$this->u[$this->highest_num[1][$i]-1]['max'];
  273.       $u_min2[$i-1]=$this->u[$this->highest_num[1][$i]-1]['min'];
  274.       $u_l2[$i-1]=($u_max2[$i-1]-$u_min2[$i-1])/3;
  275.       for($j=0;$j<3;$j++){
  276.         $this->u_sub2[$i][$j]['min']=($j==0?$u_min2[$i-1]:$this->u_sub2[$i][$j-1]['max']);
  277.         $this->u_sub2[$i][$j]['max']=$this->u_sub2[$i][$j]['min']+$u_l2[$i-1];
  278.       }
  279.       $this->u_s2=(isset($this->u_s2)?array_merge($this->u_s2,$this->u_sub2[$i]):$this->u_sub2[$i]);
  280.       unset($this->u[$this->highest_num[1][$i]-1]);
  281.     }
  282.     $this->parameter2=array($n_2nd,$u_max2,$u_min2,$u_l2);
  283.   }
  284.  
  285.   function print_devided_2nd()
  286.   {
  287.     $this->devided_2nd();
  288.     $str='';
  289.     for($i=1;$i<$this->parameter2[0];$i++){
  290.       $str.="u<sub>".$this->highest_num[1][$i]."</sub>=[".$this->parameter2[2][$i-1].",".$this->parameter2[1][$i-1]."]<ul>";
  291.       for($j=0;$j<3;$j++){
  292.         $str.="<li>u<sub>".$this->highest_num[1][$i].",".($j+1)."</sub>=[".round($this->u_sub2[$i][$j]['min'],2).",".round($this->u_sub2[$i][$j]['max'],2)."]</li>";
  293.       }
  294.       $str.="</ul>";
  295.     }
  296.     return $str;
  297.   }  
  298.  
  299.   function devided_3rd()
  300.   {
  301.     $n_3rd=count($this->highest_num[2]);
  302.     for($i=1;$i<$n_3rd;$i++){
  303.       $u_max3[$i-1]=$this->u[$this->highest_num[2][$i]-1]['max'];
  304.       $u_min3[$i-1]=$this->u[$this->highest_num[2][$i]-1]['min'];
  305.       $u_l3[$i-1]=($u_max3[$i-1]-$u_min3[$i-1])/2;
  306.       for($j=0;$j<2;$j++){
  307.         $this->u_sub3[$i][$j]['min']=($j==0?$u_min3[$i-1]:$this->u_sub3[$i][$j-1]['max']);
  308.         $this->u_sub3[$i][$j]['max']=$this->u_sub3[$i][$j]['min']+$u_l3[$i-1];
  309.       }
  310.       $this->u_s3=(isset($this->u_s3)?array_merge($this->u_s3,$this->u_sub3[$i]):$this->u_sub3[$i]);
  311.       unset($this->u[$this->highest_num[2][$i]-1]);
  312.     }
  313.     $this->parameter3=array($n_3rd,$u_max3,$u_min3,$u_l3);
  314.   }
  315.  
  316.   function print_devided_3rd()
  317.   {
  318.     $this->devided_3rd();
  319.     $str='';
  320.     for($i=1;$i<$this->parameter3[0];$i++){
  321.       $str.="u<sub>".$this->highest_num[2][$i]."</sub>=[".$this->parameter3[2][$i-1].",".$this->parameter3[1][$i-1]."]<ul>";
  322.       for($j=0;$j<2;$j++){
  323.         $str.="<li>u<sub>".$this->highest_num[2][$i].",".($j+1)."</sub>=[".round($this->u_sub3[$i][$j]['min'],2).",".round($this->u_sub3[$i][$j]['max'],2)."]</li>";
  324.       }
  325.       $str.="</ul>";
  326.     }
  327.     return $str;    
  328.   }
  329.  
  330.   function rebuild_interval($num_initial_interval)
  331.   {
  332.     for($i=0;$i<$num_initial_interval;$i++){
  333.       if($this->un[$i][0]==0) unset($this->u[$this->un[$i][1]-1]);
  334.     }
  335.     $this->u=array_merge($this->u,$this->u_s1,$this->u_s2,$this->u_s3);
  336.     sort($this->u);
  337.   }
  338.  
  339.   function print_rebuild_interval($num_initial_interval)
  340.   {
  341.     $this->rebuild_interval($num_initial_interval);
  342.     $str='';
  343.     for($i=0;$i<$this->get_num_new_interval();$i++){
  344.       $str.="u<sub>".($i+1)."</sub>=[".round($this->u[$i]['min'],2).",".round($this->u[$i]['max'],2)."]<br>";
  345.     }
  346.     return $str;
  347.   }
  348.  
  349.   function get_num_new_interval()
  350.   {
  351.     $c=count($this->u);
  352.     return $c;
  353.   }
  354.  
  355.   function get_fuzzy_sets()
  356.   {
  357.     $str='';
  358.     for($i=0;$i<$this->get_num_new_interval();$i++){
  359.       $this->mean[$i] = round(($this->u[$i]['max']+$this->u[$i]['min'])/2,2);
  360.       $this->sum_of_mean[$i] = $this->mean[$i];
  361.       $str.="A<sub>".($i+1)."</sub>=>".$this->mean[$i]."<br>";
  362.     }
  363.     return $str;
  364.   }
  365.  
  366.   function get_fuzzification()
  367.   {
  368.     $str='';
  369.     for($i=0;$i<$this->num_of_data-1;$i++){
  370.       $index_no = 1;
  371.       foreach($this->u as $t){
  372.         if($this->variation[$i] >=$t['min'] && $this->variation[$i]<=$t['max']){
  373.           $str.=round($this->variation[$i],2).' => A<sub>'.$index_no.'</sub><br/>';
  374.           $this->urut[]=$index_no;
  375.           break;
  376.         }
  377.         $index_no++;
  378.       }
  379.     }
  380.     return $str;
  381.   }
  382.  
  383.   function get_flr()
  384.   {
  385.     $str='';
  386.     for($i=0;$i<(count($this->urut)-1);$i++){
  387.       $str.='A<sub>'.$this->urut[$i].'</sub> => A<sub>'.$this->urut[$i+1].'</sub><br/>';
  388.       $this->grup[]=array($this->urut[$i],$this->urut[$i+1]);
  389.     }
  390.     return $str;
  391.   }
  392.  
  393.   function get_flrg()
  394.   {
  395.     $first=array();
  396.     $second=array();
  397.     foreach ($this->grup as $key => $row) {
  398.       $first[$key] = $row[0];
  399.       $second[$key] = $row[1];
  400.     }
  401.     array_multisort($first, SORT_ASC, $second, SORT_ASC, $this->grup);
  402.     $hasil=array();
  403.     $c=0;
  404.     for($i=0;$i<count($this->grup);$i++){
  405.       if($i==0){
  406.         $hasil[]=array($this->grup[0][0],array($this->grup[0][1]));
  407.         $c++;
  408.       }else{
  409.         if($hasil[$c-1][0]==$this->grup[$i][0]){
  410.           if($hasil[$c-1][1][count($hasil[$c-1][1])-1]!=$this->grup[$i][1]){
  411.             $hasil[$c-1][1][]=$this->grup[$i][1];
  412.           }
  413.         }else{
  414.           $hasil[]=array($this->grup[$i][0],array($this->grup[$i][1]));
  415.           $c++;
  416.         }
  417.       }
  418.     }
  419.     for($i=0;$i<count($hasil);$i++){
  420.       $this->sum_of_mean[$hasil[$i][0]-1]=0;
  421.       $n=count($hasil[$i][1]);
  422.       for($j=0;$j<$n;$j++){
  423.         $this->sum_of_mean[$hasil[$i][0]-1]+=$this->mean[$hasil[$i][1][$j]-1];
  424.       }
  425.       $this->sum_of_mean[$hasil[$i][0]-1]/=$n;
  426.     }
  427.     return $hasil;
  428.   }
  429.  
  430.   function print_flrg()
  431.   {
  432.     $this->hasil=$this->get_flrg();
  433.     $str='';$j=0;
  434.     for($i=0;$i<count($this->sum_of_mean);$i++){
  435.       $str.='A<sub>'.($i+1).'</sub>';
  436.       if($this->hasil[$j][0]==$i){
  437.         $str.='=>';
  438.         $n=count($this->hasil[$j][1]);
  439.         for($k=0;$k<$n;$k++){
  440.           $str.=($k==0?'':',').'A<sub>'.$this->hasil[$j][1][$k].'</sub>';
  441.         }
  442.         $j++;
  443.       }
  444.       $str.="=".round($this->sum_of_mean[$i],2)."<br/>";
  445.     }    
  446.     return $str;
  447.   }
  448.  
  449.   function get_forecast()
  450.   {
  451.     for($i=0;$i<$this->num_of_data+1;$i++){
  452.       $forecast_value[$i]=($i>1?$this->actual_value[$i-1]+$this->sum_of_mean[$this->urut[$i-2]-1]:0);
  453.     }
  454.     return $forecast_value;
  455.   }
  456.  
  457.   function print_forecast()
  458.   {
  459.     $str='';
  460.     $this->forecast_value=$this->get_forecast();
  461.     for($i=0;$i<$this->num_of_data+1;$i++){
  462.       $str.=(isset($this->actual_value[$i])?$this->actual_value[$i]:"?")."=>".round($this->forecast_value[$i],2)."<br>";
  463.     }
  464.     return $str;
  465.   }
  466.  
  467.   function save_forecast()
  468.   {
  469.     $this->_forecast->save_data_forecast($this->num_of_data,$this->actual_value,$this->forecast_value);
  470.   }
  471.  
  472.   function chart()
  473.   {
  474.     $record=$this->_forecast->get_forecast();
  475.     $actual_series='';
  476.     $forecast_series='';
  477.     $date_series='';
  478.     $i=0;
  479.     foreach($record as $dt){
  480.       $actual_series.=($i==0?"":",").$dt->actual_value;
  481.       $forecast_series.=($i==0?"":",").$dt->forecast_value;
  482.       $date_series.=($i==0?"'":",'").$dt->date."'";
  483.       $i++;
  484.     }
  485.     $data['actual_series']=$actual_series;
  486.     $data['forecast_series']=$forecast_series;
  487.     $data['date_series']=$date_series;
  488.     $this->load->view('main/chart',$data);
  489.   }
  490.  
  491.   function get_fer()
  492.   {
  493.     $str='';
  494.     for($i=2;$i<$this->num_of_data;$i++){
  495.       $this->fer[$i]=abs(round((($this->actual_value[$i]-$this->forecast_value[$i])/$this->actual_value[$i]),5));
  496.       $str.="|(A<sub>".($i+1)."</sub>-F<sub>".($i+1)."</sub>)/A<sub>".($i+1)."</sub>|=".$this->fer[$i]."<br>";
  497.     }
  498.     return $str;
  499.   }
  500.  
  501.   function get_afer()
  502.   {
  503.     $afer=0;
  504.     for($i=2;$i<$this->num_of_data;$i++){
  505.       $afer+=$this->fer[$i];
  506.     }
  507.     $afer/=($this->num_of_data-1);
  508.     return "AFER = ".round(($afer*100),5)."%";
  509.   }
  510.  
  511.   function delete_timeseries(){
  512.     $this->_forecast->delete();
  513.     redirect('main/index');
  514.   }
  515.  
  516.   function intro()
  517.   {
  518.     $data['title']="Stock Price Forecasting System";
  519.     $data['current'] = 'INTRO';
  520.     $this->load->view('main/intro',$data);
  521.   }
  522.  
  523.   function uploads()
  524.   {
  525.     $data['title']="Stock Price Forecasting System";
  526.     $data['current'] = 'UPLOAD';
  527.     $this->load->view('main/upload',$data);
  528.   }
  529.  
  530.   function upload_file()
  531.   {
  532.     $data['title']="Stock Price Forecasting System";
  533.     $data['current'] = 'UPLOAD';
  534.     $config['upload_path'] = 'upload';
  535.     $config['allowed_types'] = 'xls';
  536.     $config['overwrite'] = true;
  537.     $config['max_size'] = '3000';
  538.     $this->load->library('upload', $config);
  539.     if(!$this->upload->do_upload('xls')){
  540.       $this->session->set_flashdata('error_msg', $this->upload->display_errors());
  541.       redirect('main/uploads',$data);
  542.     }else{
  543.       $data = $this->upload->data();
  544.       $this->load->library('spreadsheet_excel_reader');
  545.       $this->spreadsheet_excel_reader->setOutputEncoding('CP1251');
  546.       $file =  $_SERVER['DOCUMENT_ROOT']."/forecasting/upload/".$data['file_name'];
  547.       @$this->spreadsheet_excel_reader->read($file);
  548.       $data = @$this->spreadsheet_excel_reader->sheets[0];
  549.       $query_string = "INSERT INTO time_series (date, actual_value) VALUES ";
  550.       for($i = 2; $i <= $data['numRows']; $i++){
  551.           $tanggal=explode('/',$data['cells'][$i][1]);
  552.           $tgl=$tanggal[2].'-'.$tanggal[1].'-'.$tanggal[0];
  553.           $query_string .="('".$tgl."', ".$data['cells'][$i][2]."), ";
  554.       }
  555.       $sql = substr($query_string, 0, strlen($query_string)-2);
  556.       $this->db->query($sql);
  557.       $this->session->set_flashdata('success_msg','File upload successfully');
  558.       redirect('main/uploads',$data);
  559.     }
  560.   }
  561.  
  562. }
  563.  
  564. /* End of file main.php */
  565. /* Location: ./application/controllers/main.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement