尝试执行sql查询,对两个表进行重复更新和删除。
这是可行的,但只有第一个删除不,第二个被忽略。
$sqlSalesOrderUpdate = $handler->prepare("
INSERT INTO tv_sales_orders (sales_order_id, order_number)
VALUES (:sales_order_id, :order_number)
ON DUPLICATE KEY
UPDATE sales_order_id=:sales_order_id;
DELETE FROM `tv_sales_orders_lines` WHERE sales_order_id=:sales_order_id;
DELETE FROM `tv_sales_orders_packing_list_lines` WHERE
tv_sales_order=:sales_order_id;
") ;
有一个连接,它说:
异常“pdoexception”,消息为“sqlstate[hy093]:参数编号无效:绑定变量的数量与c:\xampp5.5\htdocs\php\index中的标记数量不匹配”。php:4882 stack 跟踪:#0
$sqlSalesOrderUpdate = $handler->prepare("
INSERT INTO tv_sales_orders (sales_order_id, order_number)
VALUES (:sales_order_id, :order_number)
ON DUPLICATE KEY
UPDATE sales_order_id=:sales_order_id;
DELETE FROM `tv_sales_orders_lines` WHERE sales_order_id=:sales_order_id;
DELETE a.*, b.*
FROM tv_sales_orders_lines as a, tv_sales_orders_packing_list_lines as b
WHERE a.sales_order_id =:sales_orders_id and b.tv_sales_order_id=:sales_orders_id ;
暂无答案!
目前还没有任何答案,快来回答吧!