+ 5

how to change a password columm in my database

Hey guys I'm trying to make a change password script for my website. How do I go about it

4th Mar 2018, 2:32 PM
Franklyn Omeben
Franklyn Omeben - avatar
7 Answers
+ 5
<?php if (isset($_POST['submit'])) { include_once 'dbh.inc.php'; $hashedPwd = password_hash($newpwd, PASSWORD_DEFAULT); $sql = "UPDATE users SET user_pwd = $hashedPwd WHERE user_id = $_POST['email']"; } if (mysqli_query($conn, $sql)) { echo "Record updated successfully"; } else { echo "Error updating record: " . mysqli_error($conn); } mysqli_close($conn); ?> note that $newpwd is the new password the person has just typed in the html form
4th Mar 2018, 3:05 PM
Franklyn Omeben
Franklyn Omeben - avatar
+ 5
Here is the code @ bogdan
4th Mar 2018, 3:07 PM
Franklyn Omeben
Franklyn Omeben - avatar
+ 2
can you show us your code?
4th Mar 2018, 2:33 PM
Bogdan Bryzh
Bogdan Bryzh - avatar
+ 2
Thanks
6th Mar 2018, 4:38 PM
Franklyn Omeben
Franklyn Omeben - avatar
+ 1
your code is not orking
6th Mar 2018, 6:59 PM
Franklyn Omeben
Franklyn Omeben - avatar
6th Mar 2018, 3:23 PM
Bogdan Bryzh
Bogdan Bryzh - avatar
0
because its an example. i didnt test it yet...
7th Mar 2018, 10:14 AM
Bogdan Bryzh
Bogdan Bryzh - avatar