title: Server error while trying to display data from mysql db in php
body: <p>I have a database, db_db which I want to display data from in my browser. I have put this php code (display.php) under /var/www/ and trying to access <code>localhost/display.php</code>. Though everytime I come across "Server Error" The website encountered an error while retrieving <code>http://localhost/display.php</code>. It may be down for maintenance or configured incorrectly.</p>
  
  <p>The code is below:</p>
  
  <pre><code>&lt;?php
   //make conn
   $link = mysql_connect('localhost', 'root', '');
  
   //select db
   mysql_select_db('db_db') or die( "Unable to select db");
   $sql =  "SELECT * FROM results WHERE jobid = 'abc'";
   $records = mysql_query($sql);
  ?&gt;
  
  
  &lt;html&gt;
  &lt;head&gt;
   &lt;title&gt; Result Info &lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;table width="600" border = "1" cellpadding = "1" cellspacing= "1"&gt;
  &lt;tr&gt;
   &lt;th&gt;id&lt;/th&gt;
   &lt;th&gt;name&lt;/th&gt;
  &lt;tr&gt;
  
  &lt;?php
   while($result = mysql_fetch_assoc($records)){
     echo "&lt;tr&gt;";
     echo "&lt;td&gt;.$result['id'].&lt;/td&gt;";
     echo "&lt;td&gt;.$result['name'].&lt;/td&gt;";
     echo "&lt;/tr&gt;";
   }//end while
  ?&gt;
  
  &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Not sure where am I going wrong.</p>