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

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -