chandru_cp Posted November 23, 2009 Share Posted November 23, 2009 hai guys, plz help me... in the following function my password gets encrypted but not able to get in database.is any error in the query plz help me...... <?php $email = $_POST['username']; $oldpass=$_POST['password']; $newpass=$_POST['newpass']; $conpass=$_POST['confirmpass']; $encry_oldpass=md5($oldpass); //encrypting old password $con = mysql_connect("localhost","root",""); mysql_select_db("content_management",$con); $result=mysql_query("SELECT * FROM register_data WHERE eMail='".$email."' and password='".$encry_oldpass."' and isValidate=0 and isDelete=0"); $count=mysql_num_rows($result); if((!empty($newpass)&&!empty($conpass))&&($newpass==$conpass)&&($count=='0')) { $encry_conpass=md5($conpass);//encrypting confirm password $result2=mysql_query("UPDATE register_data SET password='$encry_conpass' WHERE eMail='".$email."' and password='".$encry_oldpass."' and isValidate=0 and isDelete=0"); echo "Password Chamged Successfully"; header("location:..............."); // redirect to login page } else { echo"Password Change Fails"; // header("location:..............."); // redirect to password change page } ?> Link to comment https://forums.phpfreaks.com/topic/182629-plz-help-me-my-password-gets-encrypted-but-not-able-to-get-in-database/ Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 Do you get any error messages? If not what does the mysql_error function return? Try changing your mysql_query lines to the following format. $sql = "YOUR QUERY HERE"; $whatever = mysql_query($sql) or trigger_error("SQL: {$sql}, ERROR: " . mysql_error(), E_USER_ERROR); Link to comment https://forums.phpfreaks.com/topic/182629-plz-help-me-my-password-gets-encrypted-but-not-able-to-get-in-database/#findComment-963916 Share on other sites More sharing options...
Anzeo Posted November 23, 2009 Share Posted November 23, 2009 If I'm correct the following line: if((!empty($newpass)&&!empty($conpass))&&($newpass==$conpass)&&($count=='0')) should be changed to if((!empty($newpass)&&!empty($conpass))&&($newpass==$conpass)&&($count!='0')) Link to comment https://forums.phpfreaks.com/topic/182629-plz-help-me-my-password-gets-encrypted-but-not-able-to-get-in-database/#findComment-963936 Share on other sites More sharing options...
cags Posted November 23, 2009 Share Posted November 23, 2009 Good spot. Link to comment https://forums.phpfreaks.com/topic/182629-plz-help-me-my-password-gets-encrypted-but-not-able-to-get-in-database/#findComment-963947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.