I've searching for this for quite some time but with no luck. I want to check if a given username and password are correct then echo something, but it's not working. After this I want to run another query.
<?php
    require "conn.php";
    $status=1;
    $user_name = $_POST["user"];
    $user_pass = $_POST["pass"];
    $sql = "select * from tbl_client where username = :user and password = :pass";
    $sth = $dbL->prepare($sql);
    $sth->execute(array(':user => $user_name' , ':pass => $user_pass' ));
    //$sth->execute(':user' => $user_name, ':pass' => $user_pass);
    $row = $sth->fetch(PDO::FETCH_NUM);
    if ($row) {
        echo 'login success , Hello';
    } else {
        echo 'login failed';
    }
    $sql = 'insert into login_status (username, status) values (:user, :status)';
    $sth = $dbL->prepare($sql);
    $sth->execute(array(':user => $username' , ':status => $status' ));
?>
 
     
    