Ok.. Am getting there slowly. In both sets of code i.e. from simplypixie as well as urtrivedi I am getting the same results. It is as if the db does not have that user there at all but it is the same user details I have logged in with initially to enable me to change the password...
It seems that the code around these lines is not picking up the password from the databse and therefore throwing out the error that the username and / or password does not match??
Error messages up to that point are ok, except if I insert an incorrect password initially then I don't get an error...
else
{
// query username old password is not correct
$query = "SELECT username FROM staff WHERE username = '".mysql_real_escape_string($username)."' and password = '".$oldpassword."'";
$result = mysql_query($query);
$row=mysql_fetch_array($result);
// Check if Old username old password is not correct
if(!$row)
{
echo "Aw shucks! Seems like you don't exist! Please recheck your username/password dude";
//mysql_create_db("abcde");
}
else
{