2016-08-08 3 views
0

eingefügt werden. Ich versuche, mehr als 100 Datensätze gleichzeitig einzufügen. Wenn mehr Datensätze vorhanden sind, wird keine Aktion ausgeführt, es sei denn, sie sendet und leitet sie an eine andere Seite weiter.Es können nicht mehr als 100 Zeilen gleichzeitig mit dem Codezeichen

Wie Sie diesen Fehler beheben.

Ich habe versucht, mit insert_batch auch. Aber keine Verwendung. Ich habe php.ini post_max_size auch geändert,

Jemand bitte helfen Sie mir.

Unten ist mein Code für Controller und Modell

Controller-Code

foreach($chkproduct as $key=>$chkvalue1){ 

    foreach($chkvalue1 as $key1=>$chkvalue2) { 


      $chkvalue=explode("/",$chkvalue2); 
      $datachk['product_id'] =$chkvalue[0]; 
      $datachk['client_id']=$chkvalue[1]; 
      $ins1=$this->Sub_model->record_count_Product($chkvalue[0]); 

      $num1=$ins1->num_rows(); 

      $qry1=$ins1->row(); 
      $prodId=$qry1->prod_rand_id; 
      $datachk['payment_id']=$paymentid; 
      $datachk['prod_rand_id']=$prodId; 
      $datachk['sub_type']  =$st1[$chkvalue[0]][$key1]; 
     $datachk['prod_type']  =$pt1[$chkvalue[0]][$key1]; 
      $datachk['quantity'] =$qty1[$chkvalue[0]][$key1]; 

      $datachk['reductionamount'] =$redamount[$chkvalue[0]][$key1]; 
      $datachk['amountafterreduction'] =$ramount[$chkvalue[0]][$key1]; 
      $datachk['individual_amt'] =$ramount[$chkvalue[0]][$key1]+$redamount[$chkvalue[0]][$key1]; 
      $cliname=$clientname[$chkvalue[0]][$key1]; 
      //$date1=$sd1[$chkvalue]; 
      //$datachk['start_date']  = date('Y-m-d', strtotime($date1)); 
      $cliname=$clientname[$chkvalue[0]][$key1]; 

      $expper=explode("-",$per1[$chkvalue[0]][$key1]); 
      //echo $expper[0]; 
      $smonth=$this->check($expper[0]); 
      if($smonth>=10){ 
       $startyear=$year1[$chkvalue[0]][$key1]-1; 
      }else{ 
       $startyear=$year1[$chkvalue[0]][$key1]; 
      } 
      //echo $st1[$chkvalue]; 
      if($st1[$chkvalue[0]][$key1]==1){ 

       $endyear=$year1[$chkvalue[0]][$key1]; 

      }elseif($st1[$chkvalue[0]][$key1]==2){ 
       if($smonth>=02 && $smonth<=10){$endyear=$year1[$chkvalue[0]][$key1]+1;}else{$endyear=$year1[$chkvalue[0]][$key1];} 
      }elseif($st1[$chkvalue[0]][$key1]==3){ 
       if($smonth>=02 && $smonth<=10){$endyear=$year1[$chkvalue[0]][$key1]+3;}else{$endyear=$year1[$chkvalue[0]][$key1]+2;} 
      } 
      //echo $endyear; 
      if($smonth==01){$endmonth=12;}else{$endmonth=$smonth-01;} 
      $ts = strtotime($expper[0]."".$startyear); 
      $lastdate=date('t', $endmonth); 
      if($endmonth=='02'){ 
       if($endyear%4==0){ 
        $lastdate1=29; 
       }else{ 
        $lastdate1=28; 
       } 
      } 
      elseif($endmonth=='04' || $endmonth=='06' || $endmonth=='09' || $endmonth=='11'){ 
       $lastdate1=30; 
      }else{ 
       $lastdate1=31; 
      } 
      //if($endmonth=='02'){$lastdate1=$lastdate-2;}elseif($endmonth%2==1){$lastdate1=30;}else{$lastdate1=31;} 
      $datachk['start_date'] =$startyear."-".$smonth."-01"; 
      $datachk['end_date'] =$endyear."-".$endmonth."-".$lastdate1; 


      $datachk['periodicityno']  = $per1[$chkvalue[0]][$key1]; 
      $datachk['year']     = $year1[$chkvalue[0]][$key1]; 
      $datachk['product_status']  =$ps1[$chkvalue[0]][$key1]; 

      if($comboval == 1 && $datachk['reductionamount']!=0){ 
       $datachk['combostatus']=1; 
      }else{ 
       $datachk['combostatus']=0; 
      } 

      $pbyp1=$this->Sub_model->getProductByperiodicity($chkvalue[0]); 
      $datapdf['products'][]=array("pname"=>$pbyp1->productname,"cliname"=>$cliname,"abbr"=>$pbyp1->productshortname,"pername"=>$datachk['periodicityno'], 
      "year"=>$datachk['year'],"subtype"=>$st1[$chkvalue[0]][$key1],"perno"=>$pbyp1->periodicity,"dur"=>$pbyp1->duration,"randid"=>$prodId,"prodid"=>$chkvalue[0]); 

      $this->Sub_model->addSubscribedProduct($datachk); 
      } 
     } 

Modell

function addSubscribedProduct($data) { 

     foreach ($data as $key => $value) { 

      if ($value=="") { 

       $array[$key] =0; 
      }else{ 

       $array[$key] =$value; 
      } 
     } 

    $res = $this->db->insert('iman_subscribed_products', $array);  
//$res = $this->db->insert_batch('iman_subscribed_products', $array); 
//echo $sql = $this->db->last_query(); 

     if($res) { 
       return 1; 
     } else { 
       return 0; 
     } 

} 

Screenshot von meiner Form

enter image description here

Antwort

0

Ich glaube, Sie max_input_vars Option PHP

der Standardwert für diese stumpled in ist 1000

Ihr Wert nur höher, um etwas ändern als das

Beachten Sie, Sie können nicht ändere es mit ini_set. Für weitere Informationen klicken Sie auf here.

+0

Danke für Ihre freundliche Hilfe. Nach dem Ändern von max_input_vars funktioniert es. – premi

0

Benutzer insert_batch() anstelle von insert() wie folgt:

$ this-> db-> insert_batch (array)); // Hier ist das Array multidimensional, das die Anzahl der Zeilen enthalten kann, wenn Sie 100 benötigen.

+0

Ich versuchte $ res = $ this-> db-> insert_batch ('iman_subscribed_products', $ array); aber funktioniert nicht – premi

+0

Es kann andere Probleme geben, die für mich arbeiten ... –

+0

Willst du irgendetwas im Code ändern oder ich möchte die Einstellungen ändern – premi

Verwandte Themen