I'm new to database. My Question is I want to update users password using his/her security code.Here Security code will be Entered by the users while the time of registration.(Name of any place/city/friend/uncle etc).I have table created named details
FNAME
LNAME
PASS
BDAY
EMAIL
CODES(//users security code)
I have an php file which checks this out but, somethings going wrong Secured.php:
<? $CODES = $_POST['CoDes'];
$PASS = $_POST['pass'];
mysql_connect('localhost','user','pass');
mysql_selectdb('userdb') or die(mysql_error());
$query = mysql_query(sprintf("UPDATE `details` SET PASS = '$PASS' WHERE CODES = '$CODES'"));
mysql_real_escape_string($CODES) or die(mysql_error()); while($row = mysql_fetch_assoc($query))
{$rows[1] = $row;}
if(empty($rows[1][CODES]))
{ header("Location: http://localhost/Error.html"); }
else{
echo "Welcome,";
echo " your password has changed successfully to $PASS";
}
?>
<b>You can login</b><a href="http://localhost/login.html><em> here.</em></a><br>
<img src="http://localhost/images/logo.gif">
This page doesn't give me any php Error, but goes to /Error.html Even when users security code exists in coloumn CODES Any help would be really thankfull.