<?php
   include("config.php");
   session_start();
   if($_SERVER["REQUEST_METHOD"] == "POST") {
      // username and password sent from form 
      $myusername = mysqli_real_escape_string($db,$_POST['username']);
      $mypassword = mysqli_real_escape_string($db,$_POST['password']); 
      $sql = "SELECT user_id FROM user WHERE username = $myusername and password = $mypassword";
      $result = mysqli_query($db,$sql);
      $rows = mysqli_fetch_array($result);
      $active = $rows["user_id"];
      $count = mysqli_num_rows($active);
      // If result matched $myusername and $mypassword, table row must be 1 row
      if($count == 1) {
         session_register("myusername");
         $_SESSION['login_user'] = $myusername;
         header("location: index.php");
      }else {
         $error = "Your Account Credentials is Invalid, Please Try Again";
      }
   }
?>
I am new to PHP and have a new question. I'm starting fresh with mysqli. And i want to Create a simple Login Form with php. can someone help me with this Error?
 
     
     
     
    