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

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -