php query doubt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeremy jacob
    New Member
    • Dec 2011
    • 1

    php query doubt

    i have two tables in a single database sales... one is product other is order... i want someones help to know how can i do one operation.... i.e

    when i click on order i want to subtract that one order from the product table....

    can u help me with the query?

    ok sure..

    Order table

    Id int
    Product_id text
    Dealer text
    Quantity int

    Product

    Id int
    Name text
    Brand text
    Expirydate date
    Mfgdate date
    Department text
    Cost int
    Quantity int
  • Ammu
    New Member
    • Aug 2011
    • 78

    #2
    Better you write a trigger at back end.
    Code:
    update product set Quantity=Quantity-new.Quantity where Product.Id=new.Id

    Comment

    Working...