Note that there are some explanatory texts on larger screens.

plurals
  1. POPayPal IPN not updating MySQL database
    primarykey
    data
    text
    <p>please excuse my ignorance in advance, but i'm fairly new to php, and this one has been bugging me for a while. i'm trying to write an IPN script for an online store that sells individual items. once the payment is complete, the script will update the database and change the availability from "available" to "unavailable". the IPN seems to work fine apart from updating the database. i'm at my wits end now as i can't see what is wrong with the script. here's what i have:</p> <pre><code>curl_close($ch); if (strcmp ($res, "VERIFIED") == 0) { $token = $_POST['invoice']; $item= $_POST['invoice']; $conn=new PDO("mysql:host=SERVER;dbname=MYDATABASE","NAME","PASS"); if ($_POST['payment_status'] == 'completed') { $sql="UPDATE `tbl_products` SET `id_status` = 3 WHERE `id_product`=:idproduct"; $stmt=$conn-&gt;prepare($sql); $stmt-&gt;bindParam(':idproduct',$item); $stmt-&gt;execute(); } if ($_POST['payment_status'] == 'pending') { $sql="UPDATE `tbl_products` SET `id_status` = 2 WHERE `id_product`=:idproduct"; $stmt=$conn-&gt;prepare($sql); $stmt-&gt;bindValue(':idproduct',$item); $stmt-&gt;execute(); } foreach ($_POST as $key =&gt; $value) { $emailtext .= $key . " = " .$value ."\n\n"; } mail("MYEMAIL", "Live-VALID IPN", $emailtext . "\n\n" . $req); } else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation foreach ($_POST as $key =&gt; $value) { $emailtext .= $key . " = " .$value ."\n\n"; } mail("MYEMAIL", "Live-INVALID IPN", $emailtext . "\n\n" . $req); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload