PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if ($un && $pw && $pw1)
{
$query = "SELECT userID FROM users where(username='$un' AND password='$pw')";
$result = @mysql_query($query);
$num = mysql_num_rows($result);
if ($num == 1)
{
$row = mysql_fetch_array($result, MYSQL_NUM);
//make the query
$query = "UPDATE users SET password='$pw1' WHERE userID=$row[0]";
if (mysql_affected_rows() == 1)
{
echo '<p><b>Your password has been changed.</b></p>';
include('templates/footer.inc');
exit();
}
else
{
$message .= '<p>Your password could not be changed due to system error</p><p>' . mysql_error() . '</p>';
}
}
else
{
$message .= '<p>Your username and password do not match our records!</p>';
}
mysql_close();
}
else
{
$message .= '<p>Please try again!</p>';
}
when i click the submit button, it returns the message "your password has been changed"...that's good...but the funny part is that, in my database, the password does not change...can you spot what maybe the problem??i scrolled to my book and i think i wrote the code right...
thanks in advance..
Last edited by pleigh on Mon Jan 30, 2006 11:05 am, edited 1 time in total.
after the $query of the update..my laziness confuses me more...but its really funny though...can someone explain why this happened??the appearance of the success message where in fact there is an error...thanks pimp for the reply..