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!
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.