Welcome Guest, Not a member yet? Register   Sign In
transactions runs fine with null value in field that do not allow null values
#1

[eluser]Zandy[/eluser]
Hi!

I have a table in SQLServer, which has 2 fields .. name and age ...
name does not allow null, it is assumed that when you try to insert a null value, in a transaction should make the rollback. ?

because I inserted the blank field, without giving me the minimum error. ?

this is a model function

Code:
function insertData( $data )
        {
            if($data["name"]==NULL) echo 'is null';
            
            $this->db->trans_begin();
            $this->db->insert('tbl_test', $data);        
            
            if ($this->db->trans_status() === FALSE)
            {
                $this->db->trans_rollback();
                return FALSE;
            }
            else
            {
                $this->db->trans_commit();
                return TRUE;
            }
        }


and this is the variable that I am going to controller function

Code:
$data = array( 'name' => $this->input->post('name_txt'),
               'age' => $this->input->post('age_txt'));

greetings.




Theme © iAndrew 2016 - Forum software by © MyBB