3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class purchase extends CI_Controller{ public function index() { $this->load->model('purchase_model'); $data['party']=$this->purchase_model->get_party(); $data['refno1']=$this->purchase_model->getref(); $data['items']=$this->purchase_model->get_items(); $this->load->view('purchase',$data); } public function getitems() { $this->load->model('purchase_model'); $this->purchase_model->getitems(); } public function getuser($id) { $this->load->model('purchase_model'); $this->purchase_model->get_user($id); } public function saveitem() { $refno= $this->input->post('refno'); $party = $this->input->post('party'); $item = $this->input->post('itemname'); $quantity = $this->input->post('quantity'); $price = $this->input->post('price'); // $amount = $this->input->post('amount'); $amount= $quantity*$price; $narration = $this->input->post('narration'); $this->load->model('purchase_model'); $partyid=$this->purchase_model->getpartyid($party); $this->load->model('purchase_model'); // $am= $this->purchase_model->getamount($refno); $result1= $this->purchase_model->checkduplicate($refno,$item); if($result1==0) { $result= $this->purchase_model->saveitem($refno,$item,$partyid,$quantity,$price,$amount,$narration); if ($result){ echo json_encode(array('success'=>true, 'msg'=>'inserted successfully', 'am'=>$amount )); } else { echo json_encode(array('msg'=>'Some errors occured.')); } } else { echo json_encode(array('success'=>true, 'msg'=>'item already exist', 'am'=>$amount )); } } public function updateitem($id) { $refno= $this->input->post('refno'); $party = $this->input->post('party'); $item = $this->input->post('itemname'); $quantity = $this->input->post('quantity'); $price = $this->input->post('price'); // $amount = $this->input->post('amount'); $amount= $quantity*$price; $narration = $this->input->post('narration'); $this->load->model('purchase_model'); $partyid=$this->purchase_model->getpartyid($party); $itemid=$this->purchase_model->getitemid('Waste Oil'); //$am= $this->purchase_model->getamount($refno); $result1= $this->purchase_model->updatecheckduplicate($id,$refno,$item); //echo json_encode(array('msg'=>$result1)); if($result1==0) { $result= $this->purchase_model->updateitem($id,$refno,$item,$partyid,$quantity,$price,$amount,$narration); if ($result){ echo json_encode(array('success'=>true, 'msg'=>'inserted successfully' )); } else { echo json_encode(array('msg'=>'Some errors occured.')); } } else { echo json_encode(array('success'=>true, 'msg'=>'inserted successfully' )); } } public function deleteitem() { $id= $this->input->post('id'); $this->load->model('purchase_model'); $result=$this->purchase_model->deleteitem($id); if ($result){ echo json_encode(array('success'=>true, 'msg'=>'inserted successfully' )); } else { echo json_encode(array('msg'=>'Some errors occured.')); } } public function submitreference() { $id= $this->input->post('refno1'); $recno= $this->input->post('recptno'); $date= $this->input->post('date'); $this->load->model('purchase_model'); // $total= $this->purchase_model->checkatleastoneitem($id); $duplicate= $this->purchase_model->checkduplicateref($id); if($duplicate!=0) { $this->load->model('purchase_model'); $data['party']=$this->purchase_model->get_party(); $data['refno1']=$this->purchase_model->getref(); $data['items']=$this->purchase_model->get_items(); $data['refexist']= $duplicate; $this->load->view('purchase',$data); } else if($total==0) { $this->load->model('purchase_model'); $data['party']=$this->purchase_model->get_party(); $data['refno1']=$this->purchase_model->getref(); $data['items']=$this->purchase_model->get_items(); $data['submitted']=1; $this->load->view('purchase',$data); } else { $this->load->model('purchase_model'); $this->purchase_model->submitreference($id,$date,$recno); $this->purchase_model->purchasestockmain($id); $data['party']=$this->purchase_model->get_party(); $data['refno1']=$this->purchase_model->getref(); $data['items']=$this->purchase_model->get_items(); $data['submitted']=2; $this->load->view('purchase',$data); } } } ?>
Output for 5.3.0 - 7.1.0
Fatal error: Class 'CI_Controller' not found in /in/mIerd on line 2
Process exited with code 255.