title: "No database selected" error even after a db is selected
body: <p>I have selected the database but for some weird reason it still says that it is not selected.</p>
  
  <p>Connection lines:</p>
  
  <pre><code>$location = "localhost";
  $user = "user";
  $pass = "pass";
  
  //Database Selection
  $link = mysql_connect($location, $user, $pass); 
  if (!$link) {
      die('Could not connect: ' . mysql_error());
  }
  //Database Selection
  mysql_select_db('database') or die(mysql_error());
  </code></pre>
  
  <p>The Query:</p>
  
  <pre><code>while ($row_fpages = mysql_fetch_array($result_fanpage))
  {
      if ( $row_fpages['client'] == NULL ) {
  
      //GRAPHS
      $sql = "SELECT date, likes FROM statistics_pages WHERE idnum='".$_COOKIE['id']."' AND page_name = ".$row_fpages['page_name']." LIMIT 7";
      $result_apps = mysql_query($sql) or die(mysql_error());
  </code></pre>
  
  <p>And the error is a plain <code>No database selected</code>.</p>
  
  <p>I have never seen this error before and i tried to change a lot of things but its just not working.</p>