mysql multi-table update php multi-table update thinkphp multi-table update
$res = $model->execute("UPDATE ez_shop_order a, ez_shop_order_status b set a.order_status=3, b.status=4 where a.id=$order_id AND b.status=3");
$order_id is the order table id
Update the order_status field with ID $order_id in the order table to 3, and update the data with status 3 in the shop_order_status table to change status to 4.
where can be written by myself. My temporary update is simple, so the statement is not so good. I can modify it myself$res = $model->execute("UPDATE ez_shop_order a, ez_shop_order_status b set a.order_status=3, b.status=4 where a.id=$order_id AND b.status=3");