Hi Everyone, get a really strange problem I have been trying to fix for a few days now and I am unable to get it working.
I have the following script as update.php file
if (isset($_GET['tx'])) {
$tx = $_GET['tx'];
// collect all parameters herer
$request = print_r($_REQUEST, true);
$sqlcode = "SELECT id, mc_gross, item_name1, quantity1, custom
FROM transactions
where txn_id='$tx'";
$sql = mysql_query($sqlcode);
$row = ($sql ? mysql_fetch_array($sql) : false);
if ($row) {
//item details
$iid = $row['id'];
$mc_gross = $row['mc_gross'];
$item_name1 = $row['item_name1'];
$quantity1 = $row['quantity1'];
$value = $row['custom'];
$result = explode(',', $value);
foreach ($result as $row) {
if (empty($row)) continue;
$item = explode('-', $row);
$itemid = $item[0];
$itemquantity = $item[1];
$sqlsold = "update products set sold = sold + $itemquantity where id='$itemid'";
$update=mysql_query($sqlsold);
}
}
}
I have created a shopping basket using PayPal IPN -
The above script is where paypal returns to after a successfull transaction.
The problem is, the script doesnt update the database on the fly. I have to press F5 for the script to update?
Can someone help me out?
Thanks