title: Cannot connect to MySQL using MySQLi_connect
body: <p>I am trying to fetch results using ajax,php and MySql. However I am getting following errors on my server side script.</p>
  
  <blockquote>
    <p>Warning: mysqli_select_db() expects parameter 1 to be mysqli, resource
    given in D:\htdocs\classes\xxx on line 10</p>
    
    <p>Warning: mysql_query(): supplied argument is not a valid MySQL-Link
    resource</p>
  </blockquote>
  
  <p>The server side code is as follows:</p>
  
  <pre><code>&lt;?php
  $q = intval($_GET['q']);
  
  $con= mysqli_connect("localhost","root","abcd123") or die ("could not connect to mysql"); 
  
  mysqli_select_db($con,"payrolldb001") or die ("no database"); 
  
  $sql="SELECT substationid,substationcode FROM wms_substation WHERE assemblylineid = '".$q."'";
  
  $result = mysqli_query($con,$sql);
  
  
  echo "&lt;select&gt;";
  while($row = mysqli_fetch_array($result))
    {
    echo "here";
    echo "&lt;option&gt;". $row['substationcode'] . "&lt;/option&gt;";
    }
  echo "&lt;/select&gt;";
  
  mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>I can not figure out where am i going wrong.Please help.</p>