Данные не вставляются в таблицу (codeigniter), все имена полей правильны, как в представлении и таблице базы данных.
Это моя модель
public function Insert() {
$data = array(
'Package_id' => $this->input->get_post('package_id'),
'cab_id' => $this->input->get_post('cab_id'),
'customer_name' => $this->input->get_post('customer_name'),
'customer_contact'=> $this->input->get_post('customer_contact'),
'customer_email' => $this->input->get_post('customer_email'),
'gender' => $this->input->get_post('gender'),
'no_of_seats' => $this->input->get_post('no_of_seats'));
$this->db->insert('booking',$data);
return ($this->db->affected_rows() != 1) ? false : true;
}
Это мой контроллер
public function Insert() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
$this->form_validation->set_rules('customer_name','Name','required');
$this->form_validation->set_rules('no_of_seats','Number Of Seats','required');
$this->form_validation->set_rules('customer_contact','Contact Number','required|exact_length[10]');
$this->form_validation->set_rules('gender','Gender','required');
$this->form_validation->set_rules('customer_email','Email ID','required');
$this->form_validation->set_rules('booking_date','Date','required');
$this->form_validation->set_rules('customer_address','Address','required');
if($this->form_validation->run()) {
$this->load->model('BookingModel');
if($this->BookingModel->Insert()) {
die('<div class="alert alert-success">Successfully Booked!</div><script>$("#response")[0].reset()</script>');
} else {
die('<div class="alert alert-danger">Failed to Book try again!</div>');
}
} else {
echo validation_errors();
}
}