title: PHP-MySQL Database Connection
body: <p>I'm learning PHP with videos of lynda.com.I created a database called widget_corp in my localhost phpmyadmin panel and I wrote these code block</p>
  
  <pre><code>    &lt;?php
  /* 1.Create a database connection */
  $connection = mysql_connect("localhost", "root", "*");
  if(!$connection){
  die("Database connection failed: " .mysql_error());
  }
  
  /* 2. Select a database to use */
  $db_select = mysql_select_db("widget_corp", $connection);
  if(!$db_select)
  {
  die("Database selection failed: " . mysql_error());
  }
  ?&gt;
  
      &lt;html&gt;
      &lt;head&gt;
      &lt;title&gt; Connection To the Database &lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;?php
  
  //3. Perform database query
  $result = mysql_query("SELECT * FROM subjects",$connection);
  if(!$result)
  {
  die("Database query failed: " .mysql_error());
  }
  
  //4. Use returned data
  
  while($row = mysql_fetch_array($result));
  {
  echo $row["menu_name"]." ".$row["position"]."&lt;br/&gt;";
  }
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  //5. Close connection
  mysql_close($connection);
  ?&gt;
  </code></pre>
  
  <p>I always get this error type:</p>
  
  <pre><code>Object not found!
  
  The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
  
  If you think this is a server error, please contact the webmaster.
  
  Error 404
  
  localhost
  Apache/2.4.4 (Unix) PHP/5.5.3 OpenSSL/1.0.1e mod_perl/2.0.8-dev Perl/v5.16.3
  </code></pre>
  
  <p>How can I overcome this issue? thanks all</p>