<?php 
	// get the data base first
	include('db_conx.php');

	$id = $_SESSION['id'];

	// getting the customers balance from the database in case there is a reduction and the session havent be restarted.
	$sql = "SELECT * FROM confidential_table WHERE id = ' $id' ";
	$query = $db_conx->query($sql);
	$row = $query->fetch_assoc();
	$pwrd = $row['pwrd'];

	// getting the values passed from the ajax 
	$pass = $db_conx->real_escape_string(trim($_POST['pass']));
	$pass2 = $db_conx->real_escape_string(trim($_POST['pass2']));
	if($pass == $pass2){
			$sql_update = "UPDATE confidential_table set pwrd = '$pass2' WHERE id = '$id'";
		$query_update = $db_conx->query($sql_update);
		if ($query_update){
			echo "success";
		}else{
			echo "error_log";
		}
	}else{
		echo "Password Mismatch";
	}

	

?>