title: How i connect my login.php like my register.php?
body: <p>I have just connected my register.php to mysql database. and i try connect my login.php but i cant.</p>
  
  <p>this is my connected register.php</p>
  
  <pre><code>$connect = mysqli_connect("mysql13.000webhost.com","a2955851_SW","********");
  
  if(isset($_POST['submit']))
  {    
      $username = mysqli_real_escape_string($connect, $_POST['username']);
      $pass = mysqli_real_escape_string($connect, $_POST['pass']);
      $pass1 = mysqli_real_escape_string($connect, $_POST['pass1']);
      $email = mysqli_real_escape_string($connect, $_POST['email']);
      if($username &amp;&amp; $pass &amp;&amp; $pass1 &amp;&amp; $email)
      {
      if($pass==$pass1)
      {
          mysqli_select_db($connect, "a2955851_SW");
          $query = mysqli_query($connect, "INSERT INTO users VALUES('$username','$pass','$email');");
          echo "You have been registered.";
      }
      else
      {
          echo "Password must match.";
      }
      }
      else
      {
          echo "All fields are required.";
      }
      }
  </code></pre>
  
  <p>and this is login.php i tryed connect this but...</p>
  
  <pre><code>    &lt;?php 
      $connect = mysqli_connect("mysql13.000webhost.com","a2955851_SW","********");
      session_start();
  
  
  
      if(isset($_POST['login']))
      {
      $username = mysqli_real_escape_string($connect, $_POST['username']);
      $password = mysqli_real_escape_string($connect, $_POST['password']);
      if($username &amp;&amp; $password)
      {
      mysqli_select_db($connect, "a2955851_SW");
      $login = mysql_query("SELECT * FROM users WHERE username = '$username'");
      while($log=mysqli_fetch_assoc($login))
      {        
  
          $dbusername = $log['username'];
          $dbpassword = $log['password'];
  
      }
      if($username==$dbusername &amp;&amp; $password==$dbpassword)
      {
  
      $_SESSION['username'] = $dbusername;
      $_SESSION['password'] = $dbpassword;
      header("location:members.php");
      }
      else
      {
  
      header("location:index.php?notify=Incorrect Username or Password.");
      }
  
      }
      else
      {
  
      header("location:index.php?notify=ALL field are required.");
      }
      }
  
  
  
  
  
  
  
  
  
      ?&gt;
  </code></pre>
  
  <p>i tried connect login.php similarly I do not know</p>