[英]How to pass php variable as value in store procedure call in sql query?
I am not getting any results while passing the values intot the stores procuder I have the code below 将值传递到商店采购员时我没有得到任何结果,下面是代码
<?php
$a="26456";
$result3=mysql_query('CALL getItemStock($a)');
$row = mysql_fetch_array($result3);
?>
Try this: 尝试这个:
$result3=mysql_query('CALL getItemStock('.$a.')');
or 要么
$result3=mysql_query("CALL getItemStock($a)");
UPDATE: 更新:
If the parameter defined as string then you need to enclose it with quotes as well. 如果参数定义为字符串,则还需要用引号将其引起来。 For example:
例如:
$a = 'I am String';
$result3=mysql_query("CALL getItemStock('$a')");
However, if the parameter defined as number, then no quotation required. 但是,如果参数定义为数字,则无需引用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.