Welcome Guest, Not a member yet? Register   Sign In
Help Column cannot be null
#1

Hello guys i just need your help about my form having error submitting it

Column 'date' cannot be null

and here's my code:

PHP Code:
public function create_purchase(){

        
$data_list = array(

            
'sup_name' => $this->input->post('sup_name'),
            
'qty' => $this->input->post('qty'),
            
'price' => $this->input->post('price'),
            
'date_expired' => $this->input->post('date_expired'),
            
'date' => $this->input->post('date')
            );

        
$this->model_products->add_purchase($data_list);
        
$this->session->set_flashdata('success''Successfully Add!');
        
redirect('admin/purchase''refresh');
    } 


Model
PHP Code:
public function add_purchase($data_list){

        
        if(
$this->db->insert('purchases'$data_list)){
            return 
TRUE;
        }else{
            return 
FALSE;
        }
    } 

Database Table
PHP Code:
CREATE TABLE `purchases` (
`
purchase_idint(11NOT NULL AUTO_INCREMENT,
`
sup_namevarchar(50NOT NULL DEFAULT '',
`
datedate NOT NULL DEFAULT '',
`
qtyint(11NOT NULL DEFAULT '',
`
pricedecimal(12,2NOT NULL DEFAULT '',
`
date_expireddate NOT NULL DEFAULT '',

// Others 

Hope you can help me. Thanks!
Reply


Messages In This Thread
Help Column cannot be null - by josh125 - 06-01-2015, 08:13 AM
RE: Help Column cannot be null - by Avenirer - 06-02-2015, 01:39 AM
RE: Help Column cannot be null - by mwhitney - 06-02-2015, 01:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB