title: Update database after complete payment PayPal
body: <p>ive got no problem with inserting the transaction after puchased is completed.<br>
  the problem is how do i update the data.</p>
  
  <p>MySQL table:
  USERS:  </p>
  
  <pre><code>  id |   email        |  credit
  ----------------------------
    1    user@email.com      2
    2    user2@email.com     1
  </code></pre>
  
  <p>PayPal IPN:</p>
  
  <pre><code>$p = new paypal_class;  
  if ($p-&gt;validate_ipn()) {
    if($p-&gt;ipn_data['payment_status'] == 'Completed') {
      $db-&gt;query("UPDATE users SET credit='". $p-&gt;ipn_data['custom'] . "' WHERE email='" . $p-&gt;ipn_data['payer_email'] . "'");
    }
  }
  </code></pre>
  
  <p>PAYPAL BUTTON -> hidden(custom) = 5 credit<br>
  PAYPAL BUTTON -> hidden(custom) = 10 credit</p>
  
  <p>if <code>user 1</code> want to topup their credit, the remaining his credit (2)+PayPal(5)= 7.<br>
  instead replacing credit(2) to (5).</p>