title: Can't connect with MySQL database, getting error "Fatal error: Class 'mysql_connect' not found in..."
body: <p>I am learning the core <a href="http://en.wikipedia.org/wiki/PHP" rel="nofollow">PHP</a> and write the below code for testing the connection with the database. I get this error:</p>
  
  <blockquote>
    <p>Fatal error: Class 'mysql_connect' not found in C:\xampp\htdocs\demo\index.php on line 4"</p>
  </blockquote>
  
  <p>The code is below:</p>
  
  <pre><code>&lt;?php
      $dbcon = new mysql_connect("localhost", "root", "");
      mysql_select_db("demo", $dbcon);
  
      $query = mysql_query("select name FROM test ");
      echo mysql_num_row($query);
      mysql_close($dbcon);
  ?&gt;
  </code></pre>