Reputation: 343
I have 3 tables:
I want to update (edit) the following: IDCategory, Name(product), IDSupplier, Price, Quantity, but i'm not doing the UPDATE query right:
$query="UPDATE products P,
category C,
suppliers S,
productsupplier PS
SET P.IDCategory = '$idcategory',
P.Name = '$Name',
S.IDSupplier = '$idsupplier',
PS.Price = '$Price',
PS.Quantity = '$Quantity'
WHERE ((IDProduct = '$idproduct')
AND (P.IDProdus = PF.IDProdus)
AND (PS.IDSupplier = S.IDSupplier )
AND (P.IDCategory = C.IDCategory))");
How do i do this right? Thank you!
Upvotes: 0
Views: 2018
Reputation: 818
http://forums.mysql.com/read.php?20,85813,85813#msg-85813 this thread should give you all the answers you need. In essence you should be using a join.
Upvotes: 1