php - How can use Codeigniter my_model class for udate with multiple where condetion? -
iam used codeigniter my_model class update table datas.
actulay need query
`update `pay_project` set `awarded` = '129' `pay_id` = 1 , `status` ='y'
for purpose tried codeignter my_model function update
$this->pay_project_model->update_by(array('pay_id'=>1,'status'=>'y'),$updatejob);
but code not working, if trying update() instead of update_by() @ time showing
`update `pay_project` set `awarded` = '129' 'id'=array()
please me solve ? trying update_many(), same not working..
the model using https://github.com/jamierumbelow/codeigniter-base-model
if using codeigniter my_model class, need change model work update_by() function
class pay_project_model extends my_model { protected $table='pay_project'; function update_by($where = array(),$data=array()) { $this->db->where($where); $query = $this->db->update($this->table,$data); return $query; } }
in my_model class there not default option update class multiple conditions, need write update_by() function. simple copy paste function inside class, , work perfectly.
Comments
Post a Comment