title: unable to select database using mysql_select_db()
body: <p>I'm using xampp v3.1.0 3.1.0 for database and php. I'm trying to make a login website. In the following php code I'm trying to fetch rows of "admin" table which is already created in the "swan" database" to check if user exits. But I'm unable to select the database using mysql_select_db() and error no 1044 is displayed. What's wrong with the code??</p>
  
  <p>Additional info: I've changed apache server port to 8081 instead of 80 as it was blocked earlier.Has this anything to do with the error?</p>
  
  <pre><code>&lt;?php  
  $empid=$_POST["empid"];
  $deptt=$_POST["deptt"]; 
  $password=$_POST["pwd"];   
  
  $con=mysql_connect("localhost","","",""); 
  if(!$con) {   die("Error in connection"); } 
  
  $db=mysql_select_db("swan",$con);               //unable to select database here
  if(!$db) {   echo mysql_errno($con); }   
  
  $query="SELECT empid,password FROM $deptt " ; 
  
  $result=mysql_query($query,$con); 
  if(!$result) {   die("error running sql"); } 
  
  while($row=mysql_fetch_array($result))
   {  
      if($row['empid']==$empid &amp;&amp; $row['password']==$password)   
      {      echo "exists";    }   
      else   
      {      echo "doesn't exist";   
      }  
   }
  
  ?&gt;   
  </code></pre>