why my code have this error, after click on button submit and click on link search:
i use of codeigniter.
An error has occured:
[object Object]
error
and this my Tour_foreign->CI_Controller:
function search_customer(){
$customer_number = $this->input->post('customer_number');
$query = $this->db->get_where('customer', array('customer_number' => $customer_number));
if($query->num_rows()==0){
echo '0';
}else{
$data = array();
foreach ($query->result() as $row)
{
$data[] = $row;
}
echo json_encode($data);
}
}
function insert_customers(){
$customer_number = "";
for($i = 0; $i < 10; $i++)
$customer_number .= mt_rand(0, 9);
/*////////////////////////////////////*/
$jdate = jgmdate("j F Y");
/*////////////////////////////////////*/
$useradmin = $this->session->userdata('login');
$query = $this->db->get_where('login', array('useradmin' => $useradmin))->row();
$nameadmin = $query->nameadmin;
$lastnameadmin = $query->lastnameadmin;
/*////////////////////////////////////*/
$data = array (
'customer_number' => $customer_number,
'name' => $this->input->post('name'),
'name_en' => $this->input->post('name_en'),
'father_name' => $this->input->post('father_name'),
'number_birth_certificate' => $this->input->post('number_birth_certificate'),
'national_number' => $this->input->post('national_number'),
'passport_number' => $this->input->post('passport_number'),
'term_passport' => $this->input->post('term_passport'),
'date_of_birth' => $this->input->post('date_of_birth') ,
'phone' => $this->input->post('phone'),
'mobile' => $this->input->post('mobile'),
'address' => $this->input->post('address'),
'nationality' => $this->input->post('nationality'),
'accommodation' => $this->input->post('accommodation'),
'education' => $this->input->post('education'),
'zip_code' => $this->input->post('zip_code'),
'marital_status' => $this->input->post('marital_status'),
'bank_name' => $this->input->post('bank_name'),
'branch_name' => $this->input->post('branch_name'),
'card_number' => $this->input->post('card_number'),
'account_number' => $this->input->post('account_number'),
'zip_code' => $this->input->post('zip_code'),
'job' => $this->input->post('job'),
'date_submit' => $jdate,
'useradmin_submit' => $nameadmin.' '.$lastnameadmin ,
);
//if(!empty($data)){
$this->db->insert('customer', $data);
//}
}
When I try to use this script I see the following error in the firebug’s console:
NetworkError: 500 Internal Server Error
This is the reason why error is showing up. Fix the server part.
Try to clean all the code inside search_customer() function and see if it runs. If this method never is executed then the problem is outside – in your framework?
Then, line by line see what is happening on the server. It can be problem with the query? But usually error 500 is when you have problem with mod_rewrite.