我在更新我的數據庫時遇到問題,當我嘗試在數據庫中更新我的密碼時,我無法更新我的數據庫中的字母密碼,例如「adnan」,但我可以更新數據庫中的數字密碼例如「1233」。我無法更新數據庫中的字母密碼
<?php
if(isset($_POST['submit'])){
$new_pass=$_POST['new_pass'];
$re_new_pass=$_POST['re_new_pss'];
$old_pass=$_POST['old_pss'];
if(empty($new_pass) || empty($re_new_pass) || empty($old_pass)){
$message="fill all the fields!";
}
else{
if(strcmp($new_pass,$re_new_pass)==0){
$con=mysqli_connect("localhost","root","","managment");
$query="SELECT user_password FROM login_table;";
$sql=mysqli_query($con,$query);
if(mysqli_num_rows($sql) > 0){
$result=mysqli_fetch_assoc($sql);
if(strcmp($old_pass,$result['user_password'])==0){
$query_insert="UPDATE login_table SET user_password=$new_pass WHERE user_password=$old_pass;";
$sql=mysqli_query($con,$query_insert);
$message="password change seccessfully!";
}
else{
$message="Old password in not correct!";
}
}
}
else{
$message="please type same passwords in both fileds!";
}
}
}
?>
<html>
<head>
<title>Tutorial</title>
</head>
<body>
<div style="width: 400px; margin: auto;">
<form action="" method="post">
<h3 align="center">Forget password</h3><br />
<div class="text-danger text-center"><?php if(isset($message)) { echo $message; } ?></div>
<div class="form-group">
<label for="login">new password</label>
<input name="new_pass" type="password" class="form-control" />
<label for="login">Re-type new password</label>
<input name="re_new_pss" type="password" class="form-control" />
<label for="login">old password</label>
<input name="old_pss" type="password" class="form-control" />
<br/>
<input name="submit" type="submit" class="btn btn-danger" />
</div>
</form>
<br />
</div>
</body>
</html>
顯示你的數據庫表的描述。 –
1st:什麼是*阿爾法密碼*?第二種:顯示數據庫表結構 – Peon
可能在您的數據庫中列的類型將是整數。 –