mysqli没有准备声明的结果?

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!

You need to use $rst = $stmt->fetch_assoc. $stmt->fetch() is only used after using $stmt->bind_result(), it fetches the results into the variables named in that call.

Note that using fetch_assoc() with a prepared statement requires that you have the MYSQLND driver installed.