I am writig a simple select statement, and since the connection object is mysqli, i cant use AND , && , OR like operators as it giving error
function getdata($value1,$value2)
{
global $conn;
$query = "SELECT id, name from users WHERE id!=$value1 && email==$value2 ";
$result = $conn->query($query);
}
This dosen't work :-(
Error: trying to get property of non object .. bla bla ..
Which means there something wrong with my sql statement, as when i try without logical operators it works, but of no use ofcourse .
Using prepare statement & bind parameters I referred to This thread SELECT in MYSQLI and tried with prepare statements.. but i'm doing something wrong i guess
$query=$conn->prepare("SELECT id, name from users WHERE id!=? && email==?");
$query->bindParam("ss", $value1,$value2); // line 20 error points here
$query->execute();
Error:
Call to a member function bindParam() on a non-object in /mydir/file.php line 20
P.S. var_dump($query);
returns bool(false)