I have 3 tables:
- Products containing IDProduct, IDCategory, Name
- Suppliers containing IDSupplier, SupplierName, Phone
- ProductSup开发者_开发知识库plier containing IDProduct, IDSupplier, Price, Quantity
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!
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.
精彩评论