所以我有这两个存储过程。第一个工作正常,但第二个不正常。它仍然执行第一个。我试着注释掉除了第二个存储的proc之外的其他程序,它运行得很好。我在这里做错了什么?
if($view='group'){
$sql = "CALL sp_edit_biochem_group('$item_group_ID','$item_group_code','$item_group_desc','$item_group_qty','$uom','$location','$inv_by','$as_of_date')";
}
elseif ($view='breakdown'){
$sql = "CALL sp_edit_biochem_breakdown('$status','$as_of_date','$serial_no','$item_breakdown_ID')";
}
您使用的是赋值运算符=
,而不是比较运算符==
。
您使用的是赋值运算符(=
)而不是相等运算符(==
)。尝试:
if($view=='group'){
$sql = "CALL sp_edit_biochem_group('$item_group_ID','$item_group_code','$item_group_desc','$item_group_qty','$uom','$location','$inv_by','$as_of_date')";
}
elseif ($view=='breakdown'){
$sql = "CALL sp_edit_biochem_breakdown('$status','$as_of_date','$serial_no','$item_breakdown_ID')";
}
这正是建议使用的原因
if ('group' == $view) {
如果您犯了类似的错误(使用=
而不是==
),您的代码将如下所示:
if ('group' = $view) {
你会得到一个致命的错误,并注意+立即修复这个问题。