So I have this MySQL command that updates values from one table to the other. The command works great on MySQL but can't seem to get it to run in PHP. I want to be able to run this command every time I refresh a page
MYSQL Command Example
UPDATE stock
INNER JOIN item USING (name)
SET stock.price = item.price, stock.quantity = item.quantity
in PHP it looks something like
$innerJoin="SELECT * FROM storeDB" .
"UPDATE stock" .
"INNER JOIN item USING (name)" .
"SET stock.price = item.price, stock.quantity = item.quantity";
mysqli_query($conn, $innerJoin);
When I refresh the page, I look into MySQL only to find the values on stock remain the same, not updated.
A bit rusty on PHP and MYSQL..
Thanks for the help
$innerJoin = "UPDATE stock INNER JOIN item USING (name) SET stock.price = item.price, stock.quantity = item.quantity";
mysqli_query($conn, $innerJoin);
You should use the same query string...
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.