Welcome Guest, Not a member yet? Register   Sign In
Cannot Get Date format from input field
#1

I am trying insert birth day from codeigniter form to mysql database as mysql date format, But i am getting like this format "06/27/2018". My model as below


PHP Code:
       
        $birth_day 
date('Y-m-d');
 
       $birth_day $this->input->post("b_day");

 
       $config['upload_path'         './uploads/member/';
 
       $config['allowed_types'       'gif|jpg|png';
 
       $config['max_size'            5000000000;
 
       $config['max_width'           50000;
 
       $config['max_height'          50000;

 
       $this->load->library('upload'$config); //Enable upload library and pass data as $config variable
 
       //upload image
 
       if ($this->upload->do_upload('photo'))
 
       {
 
           echo "File 1 Upload Success!";
 
           $upload_data $this->upload->data();
 
           $data['photo'] = "uploads/member/".$upload_data['file_name'];  //.$upload_data['file_name']; = Dispaly file name & upload path
 
       }else{
 
           echo $this->upload->display_errors();
 
       }

 
       $data['custom_member_id'] = $this->input->post("custom_member_id");
 
       $data['surname'] = $this->input->post("surname");
 
       $data['other_name'] = $this->input->post("other_name");
 
       $data['initials'] = $this->input->post("initials");
 
       $data['title'] = $this->input->post("title");
 
       $data['gender'] = $this->input->post("gender");
 
       $data['b_day'] = $birth_day;
 
       $data['category'] = $this->input->post("category");
 
       $data['nic'] = $this->input->post("nic");
 
       $data['occupation'] = $this->input->post("occupation");
 
       $data['address_01'] = $this->input->post("address_01");
 
       $data['address_02'] = $this->input->post("address_02");
 
       $data['city'] = $this->input->post("city");
 
       $data['district'] = $this->input->post("district");
 
       $data['zip_code'] = $this->input->post("zip_code");
 
       $data['h_phone'] = $this->input->post("h_phone");
 
       $data['email'] = $this->input->post("email");
 
       $data['of_phone'] = $this->input->post("of_phone");
 
       $data['mobile'] = $this->input->post("mobile");
 
       $data['religion'] = $this->input->post("religion");
 
       $data['age_group'] = $this->input->post("age_group");
 
       $data['join_date'] = $this->input->post("join_date");
 
       $data['last_renewal'] = $this->input->post("last_renewal");
 
       $data['status'] = $this->input->post("status");
 
       $data['created_by'] = $this->session->userdata("NAME");
 
       

        $this
->db->insert('membership'$data);

 
       $b_d['member_id'] = $this->db->insert_id();
 
       $b_d['name'] = $this->input->post("other_name");
 
       $b_d['b_date'] =   DATE($this->input->post("b_day"));

 
       $this->db->insert('birth_day'$b_d); 


After that I try to get birth day to reminder. But its not work with this date format. I am using bootstrap datetimepicker. 
Reply


Messages In This Thread
Cannot Get Date format from input field - by sanjaya - 06-24-2018, 11:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB