I\'m doing some exercises from Beginners PHP & MySQL by Mr. Tucker.
On his example everything works fine, but on my PC there is an error:
Just before while
where you set variable $passwordRetrieved declare it so it should look like this:
$tUser_SQLselect_Query = mysql_query($tUser_SQLselect);
$passwordRetrieved = "";
while ($row = mysql_fetch_array($tUser_SQLselect_Query, MYSQL_ASSOC)) {
$passwordRetrieved = $row['password'];
}
As this question has already been answered, I would also add instead of using mysql_fetch_array with the MYSQL_ASSOC parameter, you can just use mysql_fetch_assoc() :)
If your query returned no results, then $passwordRetrieved is undefined (just like the message says).
You should throw an error when you couldn't find any users with username=$username (which is also an invalid login).