Jump to content


This topic is now archived and is closed to further replies.



Recommended Posts

I am new to php and to paypal, but I don't think this question is very hard...

I have an "inventory_count" column in a mysql table. I want the inventory count to subtract one every time I sell that item through paypal. I have the IPN script from the paypal site and I added a few lines of code to try to accomplish this task... but the inventory_count remains unchanged. I have my sandbox account set to reference this script in the IPN section. Can somebody tell me what I am doing wrong? I only added the part between "process payment" and "else if".

And for some reason I get an error when I try to post all the code here... but here is what I added:

$query = "SELECT inventory_count FROM tm_inventory WHERE id = $item_number";
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$inventory_count = $row['inventory_count'];
$new_inventory_count = $inventory_count - 1;

$query2 = "UPDATE tm_inventory SET inventory_count = '$new_inventory_count' WHERE id = $item_number";

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.