我刚刚完成了一个小型的迷你注册表单,您可以在其中输入用户名,密码和消息,然后将其插入到具有以下列的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'];
}
}
我想尝试转到指定用户名colum,并从中获取信息,例如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
我知道我做错了什么,但是什么? 谢谢!