I have this prepare statement for user login. It works fine, return 1 if login is correct.
After that i need to get user id and his user name (from bd, i think its better then put from input direct to session).
But i have no result in this $rst["id"];
and $rst["user"];
what is the problem?
$stmt = $mysqli_link->prepare("SELECT id, user FROM cadastro WHERE binary user = ? AND binary senha = ?");
$stmt->bind_param('ss', $user, $senha);
$stmt->execute();
$stmt->store_result();
$num = $stmt->num_rows;
if($num > 0)
{
//Retorna os dados do banco
$rst = $stmt->fetch();
$id = $rst["id"];
$user = $rst["user"];
$sessionid = md5(time());
echo"$user - $id - $sessionid";
}
?>
thank you!