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

Recommended Answers

All 3 Replies

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.

An Ajax reload would be great

Can anyone sugguest a better soloution than "An Ajax Reload"...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.