Jump to content


Photo

test


  • Please log in to reply
No replies to this topic

#1 danielforsyth

danielforsyth
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 07 March 2006 - 02:59 AM

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);




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users