I want to fix this error. I want to get the column that name in database is role and put it into session
$username = $_POST['username'];
$password = $_POST['password'];
$statment = $con->prepare("select * from users where username = ? and password = ? limit 1");
$statment->execute(array($username,$password));
$count = $statment->rowCount();
$row = $statment->fetchColumn();
if($count > 0)
{
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
$_SESSION['role'] = $row['role'];
echo 'User Name : '.$_SESSION['username'].' , Password : '.$_SESSION['password'].' , Role : '.$_SESSION['role'];
}
else
{
echo 'Failed To Login';
}