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