donjakobo / A3M

A3M - Bootstrapped - A CodeIgniter OpenID/Oauth boilerplate library utilizing Twitter Bootstrap UI
Other
107 stars 53 forks source link

account_details_model->update issue, with fix and explanation #129

Closed cwingrav closed 8 years ago

cwingrav commented 9 years ago

When account_details_model->update is called to update the table a3m_account_details and there are no changes, the update database call never fires. Since $this->db is stateful, it affects the next database call. This may be a mysql/mysqli issue since I am using mysqli (as set in my config/database.php settings). To avoid this problem, I added a check that there is actually something to update before the update is called:

starting at line 121:

// Update
if ($this->get_by_account_id($account_id))
{
    if ( count($attributes) != 0 )  {   // <--- new code here
        $this->db->where('account_id', $account_id);
        $this->db->update('a3m_account_details', $attributes);
    }  // <--- new code here
...
StorytellerCZ commented 9 years ago

Could you submit a PR request with the changes so you can get the credit? Also which version?

cwingrav commented 9 years ago

I'm not really clear on what that means. Do you create a branch for me? If so, let me know and I'll do it. I have 3 issues with solutions so far I can roll in.

StorytellerCZ commented 9 years ago

You can read about it here: http://help.github.com/send-pull-requests/ or https://github.com/donjakobo/A3M/blob/ci3-beta/contributing.md Since you have 3 fixes it would be best to do a pull request.