There are two tables:
orders
____________________
order_id | Stat
--------------------
1 | waiting
2 | waiting
3 | waiting
second table:
product
____________________
order_id | product_id
---------------------
1 | 53
2 | 54
3 | 54
order_id value is the same in both tables. I would like to update Stat from 'waiting' to 'done' in Orders table if product_id is '54' in Product table.
I tried this code but didn't work:
mysql_query("UPDATE orders SET stat='done' FROM product WHERE product_id='54'");
will appreciate your help :)
mysql_*extension. It's deprecated, issues notices, is unsafe, not maintained and will be removed some time in the future. Usemysqli_*orPDOinsteadmysqli_*looks a lot likemysql_*, they don't translate 1 on 1: the new extensions are a bit more complicated, and a lot more powerful.