php - "Call to a member function bind_param() on a non-object" upon adding OR parameter
Get the solution ↓↓↓Below is a function I am trying to run via PHP, if I remove the section "H=Y OR ?" and instead just run it as "H=?" it runs perfectly fine. Any help figuring out why this is not working would be greatly appreciated.
function getInfo($Z)
{
global $mysqli;
$stmt = $mysqli->prepare("SELECT A,B,C,D,E,F,G,I,J FROM DB WHERE H=Y OR ?");
$stmt->bind_param("s", $Z);
$stmt->execute();
$stmt->bind_result($A,$B,$C,$D,$E,$F,$G,$I,$J);
while ($stmt->fetch())
{
echo "$A,$B,$C,$D,$E,$F,$G,$I,$J\n";
}
$stmt->close();
}
Answer
Solution:
Do you mean for it to be H=Y or H=? like this:
... FROM DB WHERE (H=Y) OR (H=?)
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: mysqli::real_connect(): (hy000/2002): connection refused
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.