Jump to content

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";
mysql_query($query2);
Link to comment
https://forums.phpfreaks.com/topic/4287-paypal-ipn-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.