我刚刚完成了一个小迷你注册表单,您在其中输入用户名、密码、消息,它将使用以下列将其插入到 mysql 中:
username password id message date time country recover_id
这些意味着:
ID = a random generated ID, for later use.
Time = Time of creation
Date = date of creation
Country = empty, later use..
Recover_id = the ID of the registration.
注册后,我这样做:
// Let's store these into a session now.
$username = $_SESSION['user'];
$password = $_SESSION['pass'];
//Now let's refresh the page, to a different header.
header('Location: recover.php?recovery=success');
}
存储用户名并传递给会话,然后创建一个新标头。
接着
}
else if (isset($_GET['recovery']) && $_GET['recovery'] == 'success')
{
$fetch = $connect->query("SELECT * FROM users WHERE username = ':username' LIMIT 1");
$fetch->bindValue(':username', $_SESSION['user']);
$fetch->execute();
while($row = mysql_fetch_array($fetch)) {
echo $row['recover_id'];
}
}
我想尝试转到指定的用户名列,并从中获取信息,例如 recovery_id 或 ID 本身。
但这并
Warning: mysql_fetch_array() expects parameter 1 to be resource, object given in C:\xampp\htdocs\recover\recover.php on line 103
我知道我做错了什么,但是什么?谢谢!