codeigniter - updating multiple values to mysql database using codeignter -
codeigniter - updating multiple values to mysql database using codeignter -
my post info form coming
array ( [radiogroup_1] => 1 [radiogroup_2] => 4 [radiogroup_4] => 11 [submit] => submit )
and model
function add_votes(){ foreach($post[] $k=> $v){ $id = $v; } $this->db->where('answerid','radiogroup_'. $id ); $this->db->set('votes', 'votes+1',false); $this->db->update('vote_table'); }
apparently, it's not working, please help me in code
maybe
function add_votes(){ foreach($_post[] $k=> $v){ $this->db->where('answerid','radiogroup_'. $v ); $this->db->set('votes', 'votes+1',false); $this->db->update('vote_table'); } }
or
function add_votes(){ foreach($_post[] $k=> $v){ $this->db->where('answerid', $v ); $this->db->set('votes', 'votes+1',false); $this->db->update('vote_table'); } }
codeigniter
Comments
Post a Comment