title: Can I mix MySQL APIs in PHP?
body: <p>I have searched the net and so far what I have seen is that you can use <code>mysql_</code> and <code>mysqli_</code> together meaning:</p>
  
  <pre><code>&lt;?php
  $con=mysqli_connect("localhost", "root" ,"" ,"mysql");
  
  if( mysqli_connect_errno( $con ) ) {
      echo "failed to connect";
  }else{
      echo "connected";
  }
  mysql_close($con);
  echo "Done";
  ?&gt;
  </code></pre>
  
  <p>or </p>
  
  <pre><code>&lt;?php
  $con=mysql_connect("localhost", "root" ,"" ,"mysql");
  if( mysqli_connect_errno( $con ) ) {
      echo "failed to connect";
  }else{
      echo "connected";
  }
  mysqli_close($con);
  echo "Done";
  ?&gt;
  </code></pre>
  
  <p>Are valid but when I use this code what I get is:</p>
  
  <pre><code>Connected
  Warning: mysql_close() expects parameter 1 to be resource, object given in D:\************.php on line 9
  Done
  </code></pre>
  
  <p>For the first and the same except with <code>mysqli_close()</code>. For the second one.</p>
  
  <p>What is the problem? Can't I use <code>mysql_</code> and <code>mysqli</code> together? Or is it normal? Is the way I can check if the connections are valid at all? (the <code>if(mysq...)</code>)</p>