title: trying to get PHP and database to work together
body: <p>I'm trying to teach myself how to work with php and mysql. For practice, I made a simple test website that takes a username and a password, and a database using phpmyadmin and mysql. I was able to create a successful connection to my DB, but now I'm trying to take the data from the form on my website and insert it into a table called 'account'. Account has three fields: 'username', 'password', and 'userID'(primary key). user ID is supposed to auto increment, so that field doesn't require input data. I wrote code that I thought would collect the username and password and add it as a new record in the account table, but I get an error message:</p>
  
  <blockquote>
    <p><strong>Internal Server Error</strong></p>
    
    <p>The server encountered an internal error or misconfiguration and was
    unable to complete your request.</p>
    
    <p>Additionally, a 404 Not Found error was encountered while trying to
    use an ErrorDocument to handle the request.</p>
  </blockquote>
  
  <p>Below I've included my code. I've never worked with PHP before or made a DB before so it's possible I've made very obvious mistakes. </p>
  
  <h1>php_script</h1>
  
  <pre><code> &lt;?PHP
  
      $db_host = "stevie.heliohost.org";
      $db_username = "secret";
      $db_pass = "secret";
      $db_name = "secret";
  
      $connection = @mysql_connect ("$db_host","$db_username", "$db_pass") 
      or die ("could not connect to mySQL");
  
  
      @mysql_select_db("$db_name") or die ("No database");
  
      $sql="INSERT INTO account(username, password)
      VALUES('$_POST[user]','$_POST[password]')";
      if (!mysql_query($sql,$connection ))
        {die('Error: ' . mysql_error());}
      echo "1 record added";
  
      mysql_close($con);
  
  ?&gt;
  </code></pre>
  
  <h1>HTML FORM</h1>
  
  <pre><code> &lt;form name="LOGIN" action="php_script.php" method="post"&gt;
  
       Username: &lt;input id="username" type="text" name="user"&gt;   
       password: &lt;input  id="password" type="text" name="password"&gt;
          &lt;input id="submit" type="submit" value="Submit"&gt;
  
    &lt;/form&gt;
  </code></pre>