0

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

2
Contributors
3
Replies
32
Views
3 Years
Discussion Span
Last Post by everton.retweets
0

When I press f5 - The database updates the correct product id's with the correct amount of purchases.

It's driving me mad why its not updating as the script loads.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.