views:

38

answers:

1

Hi, I have a table with one columns datatype as BIT(1) . I am using active record of codeigniter for performing queries. But the setting of bit is not working. Does anybody has idea about how to do it? Or I have to get back to normal query?

Following is the code snippet:

function itemUpdate($options=array()) {
if(isset($options['isAvailable']))
   $itemDB->set('isAvailable',$options['isAvailable']);
   $itemDB->where('id', $options['id']);
   $itemDB->update('Item');
}
+1  A: 

I often use:

$this->db->set('foo', (int) !empty($options['foo']));

Makes a 0/1 response pretty foolproof.

Phil Sturgeon