Database performance with looped update queries?

RoCk-StaR

New Member
I am currently structuring my queries for a database update model with CodeIgniter.I getting the form posted input keys with \[code\]$keys = array_keys($_POST)\[/code\]To update according database fields I was wanting to do something like this\[code\]foreach($keys as $key){ $data = http://stackoverflow.com/questions/3846506/$this->input->post($key); $this->db->query("Update $table SET '$key'='$data' WHERE user_id='$the_user->id'"); }\[/code\](this is not production code, just trying to illustrate my question, hence no escaping, validation, etc...)My question is, does this pose a performace problem by running a seperate query for each individual piece of form data submitted?EDIT: sorry didn't intend for it to sound like a yes or no question, obviously if yes or no, the answer is yes, but I am looking for more of to what degree does it hamper the performance?
 
Back
Top