Answers.Body: <p>You can use <a href="https://docs.civicrm.org/dev/en/latest/api/" rel="nofollow noreferrer">civicrm api</a> to process CRUD on CiviCRM Database.</p>
  
  <p>To update contribution you can use</p>
  
  <pre><code>$result = civicrm_api3('Contribution', 'create', [
    'id' =&gt; $contrib_data[0]-&gt;id,
    'contribution_status_id' =&gt; $contribution_status_id,
  ]);
  </code></pre>
  
  <p>Cheers</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-26T10:52:44.533Z
Answers.LastActivityDate: 2019-04-26T10:52:44.533Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I am working with civi 5.10. How can i update the conribution table row based on contribute id .  I want replace that below  code with civicrm_api3().</p>
  
  <pre><code>        db_update('civicrm_contribution') // Table name no longer needs {}
          -&gt;fields(array(
          'contribution_status_id' =&gt; $contribution_status_id,
          ))
          -&gt;condition('id', $contrib_data[0]-&gt;id, '=')
          -&gt;execute();
  </code></pre>
  
Tags: <drupal><civicontribute>
Title: Update particular contribute based on contribute id with civicrm_api3
ThreadText: # Update particular contribute based on contribute id with civicrm_api3
  
  (Asked by: username_0 on 2019-04-26)
  
  I am working with civi 5.10. How can i update the conribution table row based on contribute id . I want replace that below code with civicrm\_api3().
  
  ```
          db_update('civicrm_contribution') // Table name no longer needs {}
          ->fields(array(
          'contribution_status_id' => $contribution_status_id,
          ))
          ->condition('id', $contrib_data[0]->id, '=')
          ->execute();
  
  ```
  
  **Tags:** drupal, civicontribute
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-26. Score: 1 | Accepted answer
  
  You can use [civicrm api](https://docs.civicrm.org/dev/en/latest/api/) to process CRUD on CiviCRM Database.
  
  To update contribution you can use
  
  ```
  $result = civicrm_api3('Contribution', 'create', [
    'id' => $contrib_data[0]->id,
    'contribution_status_id' => $contribution_status_id,
  ]);
  
  ```
  
  Cheers
  
  username_1
  
  
  ---
  
  