$count prints out 0 it is retrieving correct username and password from database. Ideas?
<?php
include_once ('connection.php');
class User{
private $db;
public function __construct(){
$this->db = new Connection();
$this->db = $this->db->dbConnect();
}
public function Login($username, $password)
{
if(!empty($username) && !empty($password)){
$st = $this->db->prepare("select * from users where username=? and password=?");
$st->bindParam(1, $username);
$st->bindParam(2, $password);
$st->execute();
$count = $st->rowCount(); Print $count; echo $username, ' ', $password;
if($st->rowCount() == 1){
echo "User verified. Access granted";
}else{
echo "Incorrect username or password";
}
}else{
echo "Please enter username and password";
}
}
}
?>