Php bind_param()错误不可理解 [英] Php bind_param() error not understandable
本文介绍了Php bind_param()错误不可理解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有以下代码:
Hi
I have the following code:
$stmt="SELECT state FROM branch_info WHERE state = ? AND branch = ?";
if($stmt === false)
{
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->errno . ' ' . $conn->error, E_USER_ERROR);
}
$param1=$_POST["states"];
$param2=$_POST["exstbr"];
$stmt->bind_param('ss',$param1,$param2);
$stmt->execute();
$result = $stmt->get_result();
while($row = $result->fetch_array(MYSQLI_ASSOC))
{
if($row["state"] > 0)
echo "Already Exists";
}
$stmt->close();
我收到以下错误:
I got the following error:
Fatal error: Call to a member function bind_param() on string in C:\---------------------------------------------- on line 60
在这方面请帮忙。这很紧急。提前致谢。
我的尝试:
我有试图直接传递参数它没有用。
我用echo $ param1;和echo $ param2在bind_param()语句之前检查值的存在,并在网页上回显值。
我也试过
$ stmt-> bind_param (ss,$ param1,$ param2);
但没有奇迹。
Kindly help in this regard. Its urgent. Thanks in advance.
What I have tried:
I have tries to pass in the parameters directly it didnt work.
I used echo $param1; and echo $param2 to check the values presence before bind_param() statement and the values are echoed fine on the web page.
I also tried
$stmt->bind_param("ss", $param1, $param2);
but no wonders.
推荐答案
stmt = SELECT state FROM branch_info WHERE state =?AND branch =?;
if(
stmt="SELECT state FROM branch_info WHERE state = ? AND branch = ?"; if(
stmt === false)
{
trigger_error(' 错误的SQL:'。
stmt === false) { trigger_error('Wrong SQL: ' .
sql 。< span class =code-string>' 错误:'。
这篇关于Php bind_param()错误不可理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文