title: Why won't my SELECT * FROM work?
body: <p>Here is the code for my entire index page, which includes a register and a login.  For some reason, the register part works fine, and it is inserting correctly.  Yet, the login part is not working, as whenever I call the $queryrun(mysql_query($query)) on the SELECT * FROM, it does not work.</p>
  
  <pre><code>&lt;?php
  
  require('includes/dbconnect.php');
  
  $firstname = $_POST['firstname'];
  $lastname = $_POST['lastname'];
  $email = $_POST['email'];
  $password = $_POST['password'];
  $password = md5($password);
  
  $logemail = $_POST['logemail'];
  $logpassword = $_POST['logpassword'];
  $logpassword = md5($logpassword);
  
  // Register Script
  
  if (isset($firstname) &amp;&amp; !empty($firstname) &amp;&amp; !empty($lastname) &amp;&amp; !empty($email) &amp;&amp;   !empty($password)) {
  $query = "INSERT INTO users VALUES('', '$firstname', '$lastname', '$email', '', 'm',   '9', '$password', 'bio'";
    $queryrun = mysql_query($query);  
  } else {
  echo 'Please fill out all of the form fields';
  }
  
  // Login Script
  
  if (!empty($logemail) &amp;&amp; !empty($logpassword)){
  $query = "SELECT * FROM users WHERE email = '$email' AND password = '$password'";
  
  
  $queryrun = mysql_query($query);
  
  while ($row = mysql_fetch_assoc($queryrun)) {
      $logemail = $row['logemail'];
  
  }
  echo $logemail;
  $numrows = mysql_num_rows($query);
  if ($numrows &gt; 0){
      echo 'User exists';
  } else {
      echo 'User does not exist';
  }
  
  } else {
  
  }
  
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form action="index.php" method="POST"&gt;
  
  Firstname: &lt;input type="text" name="firstname" /&gt;&lt;br /&gt;
  Lastname: &lt;input type="text" name="lastname" /&gt;&lt;Br /&gt;
  Email: &lt;input type="text" name="email" /&gt;&lt;br /&gt;
  Password: &lt;input type="password" name="password" /&gt;&lt;br /&gt;
  &lt;input type="submit" value="Submit" /&gt;
  
  &lt;/form&gt;
  
  &lt;br /&gt;&lt;hr /&gt;
  
  &lt;br /&gt;
  Login:&lt;br /&gt;
  &lt;form action="index.php" method="POST"&gt;
  Email:&lt;input type="text" name="logemail" /&gt;&lt;br /&gt;
  Password: &lt;input type="password" name="logpassword" /&gt;&lt;br /&gt;
  &lt;input type="submit" value="Log in" /&gt;&lt;br /&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The connection to the database is fine because the register part code works, it's just the login code is returning nothing and saying that the user does note exist, when the user actually does exist</p>