title: Simple PHP SQL login troubleshooting
body: <p>I am trying to create a very basic PHP login by retrieving a registered username/password from a database. This is not ever going live and I am aware there is zero input validation. All I'm trying to do is select data from a database in a login.</p>
  
  <p>Here is the login form on index.html:</p>
  
  <pre><code>    &lt;table width="250" border="0" align="center" cellpadding="0" cellspacing="1"    bgcolor="#CCCCCC"&gt;
      &lt;tr&gt;
      &lt;form name="form1" method="post" action="checklogin.php"&gt;
      &lt;td&gt;
      &lt;table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"&gt;
      &lt;tr&gt;
      &lt;td colspan="3"&gt;&lt;strong&gt;Member Login &lt;/strong&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td width="78"&gt;Username&lt;/td&gt;
      &lt;td width="6"&gt;:&lt;/td&gt;
      &lt;td width="294"&gt;&lt;input name="Username" type="text" id="Username"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;Password&lt;/td&gt;
      &lt;td&gt;:&lt;/td&gt;
      &lt;td&gt;&lt;input name="Password" type="text" id="Password"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;input type="submit" name="Submit" value="Login"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
      &lt;/td&gt;
      &lt;/form&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>And here is the PHP checklogin.php:</p>
  
  <pre><code>   &lt;?php
  
      $sql_connection = mysqli_connect ("localhost:8889","root","root","derek_website_tmp");
  
      if (mysqli_connect_errno())
  {
   echo "failed to connect" . mysqli_connect_error();
  }
  
      $Username=$_POST['Username'];
      $Password=$_POST['Password'];
  
      $sql = "SELECT * FROM $Members WHERE Username = '$Username' and Password = '$Password'"
      $result=mysqli_query($sql);
  
      $count = mysql_num_rows($result);
  
      if ($count==1) {
      $_SESSION['Username'] = $Username;
      $_SESSION['Password'] = $Password;
      header('location:login_success.php');
      }
  
      else {
      echo 'Wrong Username or Password';
      }
  
      if (!mysqli_query($sql_connection))
  {
  die('Error : ' . mysqli_error($sql_connection));
  }
  
      mysqli_close ($sql_connection);
  
      ?&gt;
  </code></pre>
  
  <p>When I try this I get an error retrieving checklogin.php
  Any help would be greatly appreciated.</p>