title: username and password validation in php mysql
body: <p>What I want to be able to do is: When a user enters their username and password in the form on the index.html page, if they match what is in the DB, then they get sent to the next page; userlogin.php.
  If their username or password is incorrect then they are asked to re-enter their details on the index.html page, and displaying an error like, "Your username is Incorrect" or "Your password is Incorrect" above the form text box. I can paste this code if required.</p>
  
  <p>Can I change this text font color as well, to red for example?</p>
  
  <p>This is the code I currently have for the userlogin.php page</p>
  
  <pre><code>&lt;?php
  mysql_connect("Server", "root", "Gen") or die("Couldn't select database.");
  mysql_select_db("generator") or die("Couldn't select database.");
  
  $username = $_POST['username'];
  $password = $_POST['password'];
  
  $sql = "SELECT * FROM users WHERE Username = '$username' AND Password = '$password' ";
  $result = mysql_query($sql) or die(mysql_error());
  $numrows = mysql_num_rows($result);
  if($numrows &gt; 0)
     {
      echo 'Your in';
     }
  else
     {
      echo 'Your not in';
     }
     ?&gt;
  </code></pre>