title: No Database Selected - PHP & MySQL
body: <p>I am trying to connect to my database and when I run the code, I get an error. Can anybody tell me what is wrong also any errors in my PHP code? Thanks.</p>
  
  <pre><code>Error: No database selected
  </code></pre>
  
  <p><strong>PHP Code:</strong></p>
  
  <pre><code>include('.conf.php');
  $prof = $_GET['profile'];
  $prof = addslashes(htmlentities($prof));
  $query = "SELECT * FROM aTable where id = '".mysql_real_escape_string($prof)."'";
  $info_array = mysql_query($query, $con) or die (mysql_error()).;
  
  while($row = mysql_fetch_array( $info_array )) 
  {
      echo $row['num1'];
      echo "&lt;/br&gt;";
      echo $row['num2'];
      echo "&lt;/br&gt;";
      echo $row['num3'];
      echo "&lt;/br&gt;";
      echo $row['num4'];
  };
  
  mysql_close($con);
  </code></pre>
  
  <p><strong>.conf.php</strong> file:</p>
  
  <pre><code>&lt;?php
      $conf['db_hostname'] = "xxx";
      $conf['db_username'] = "xxx";
      $conf['db_password'] = "xxx";
      $conf['db_name'] = "xxx";
      $conf['db_type'] = "mysql";
  
      $con = mysql_connect('xxx', 'xxx', 'xxx') or die (mysql_error());
      $db  = mysql_select_db("aTable", $con);
  ?&gt;
  </code></pre>