title: mysqli_query() expects parameter 2 to be string
body: <p>I am getting the error</p>
  <blockquote>
  <p>Warning: mysqli_query() expects parameter 2 to be string, object given in C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\login.php on line 10
  Error:</p>
  </blockquote>
  <p>On executing the query</p>
  <pre><code>&lt;?php
  $con=mysqli_connect(&quot;127.0.0.1&quot;,&quot;root&quot;,&quot;&quot;,&quot;forms&quot;);
  if (mysqli_connect_errno())
    {
    echo &quot;Failed to connect to MySQL: &quot; . mysqli_connect_error();
    }
    
    $sql=mysqli_query($con,&quot;SELECT * FROM register Where username='$_POST[username]' AND password='$_POST[password]'&quot;);
    
    if (!mysqli_query($con,$sql))
    {
    die('Error: ' . mysqli_error($con));
    }
  echo &quot;login success&quot;;
  
  mysqli_close($con);
  ?&gt;
  </code></pre>