How to store password in MYSQL ?

i created the new page,

<form action="calc.php" method="POST">
Username: <input type="text" name="username">
Password: <input type="password" name="password">
<input type="submit" name="submit" value="Submit">

and clac.php,

$username = $_POST['username'];
$pass = $_POST['password'];
if ($username == "a" && $pass =="abc")
/* here i set the password to "abc" */
	echo 'Welcome to the Page';
	echo '<a href="cp.html">Change Pass</a>';
	echo "Wrong";

and here is cp.html,

<form method="POST">
<input type="password" name="newpassword">
<input type="submit" name="submit">

i want to store that password in mysql and when a users clicks on change password and entered new password then the old password shoukld be replace by old password in mysql and it automatically set to the default value of password. , how can i do this ?
i am newbie in php and don't know how to store something in MYSQL

8 Years
Discussion Span
Last Post by keval_hack

Hi Xufyan,

It looks like you have a lot to learn but have no fear i believe this resource will be fantastic for you to get to grips with what you want to do, and will also help you improve your login/registration files. Go to this link http://www.youtube.com/watch?v=h1Cv3zpWXj4

Enjoy and happy coding!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.