$data = array( 'p1' => $_POST['p1'], 'p2' => $_POST['p2'] etc....... ) $this->db->query("update tabla set $data where id = ''1");