<?php //session_start(); //connect to database include "../pages/connect.php"; //$db = mysql_connect("localhost", "root", "rangers", "doctor"); /*if (!$db) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($db);*/ if(isset($_POST['change_password_btn'])) { $username = mysql_real_escape_string($_POST['user_id']); $password = mysql_real_escape_string($_POST['password']); $newpassword = mysql_real_escape_string($_POST['passwordnew']); if($row['password']==($password)) { // update data in mysql database $sql="UPDATE registerdoctors SET password='$newpassword' WHERE doc_id='$username'" or die ("this stuffed up"); $result=mysql_query($sql) or die ("this stuffedup"); } // if successfully updated. if($result){ //echo "Successful"; ?> <script type="text/javascript"> alert("password updated successfully."); window.location.href = '../pages/doctorwelcome.php?page=changepassword'; </script> <?php } else { //echo "error"; ?> <script type="text/javascript"> alert("error updating..."); window.location.href = '../pages/doctorwelcome.php?page=changepassword'; </script> <?php } } ?>
Change password but first match current password and the update the new password. But I am getting error updating password with this code. Please help me.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)