Jump to content

change password


jalaladdin

Recommended Posts

i wrote this script but explorer show me this error
<?php session_start();// connect to the mysql server$link = mysql_connect($server, $db_user, $db_pass)or die ("Could not connect to mysql because ".mysql_error());// select the databasemysql_select_db($database)or die ("Could not select database because ".mysql_error());$username = $_POST['username'];$password = $_POST['password'];$newpassword = $_POST['newpassword'];$confirmnewpassword = $_POST['confirmnewpassword'];$result = mysql_query("SELECT password FROM users WHERE username='$username'");if(!$result) { echo "The username you entered does not exist. "; } else if($password!= mysql_result($result, 0)) { echo "You entered an incorrect password. "; } if($newpassword=$confirmnewpassword) 	$sql=mysql_query("UPDATE users SET password='$newpassword' where username='$username'"); 	if($sql) 	{ 	echo "Congratulations! You have successfully changed your password. "; 	}else{ echo "The new password and confirm new password fields must be the same. "; }  ?>

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /www/110mb.com/b/b/q/s/q/u/i/r/bbqsquirrelbrigade/htdocs/changepw.php on line 27

Link to comment
Share on other sites

There is no such thing as a universal "change password" script (except one that prints "change password") - you need to write one that is specific to your application. If you try to follow the advice we give you in debugging your script, then eventually you should be able to get a working solution.

Link to comment
Share on other sites

Sounds like a broken record to me.Love your answer justsomeguy!I suggest making sure your matching your field names properly, as well as table name. And echo the row count as mentioned above. Then post back with meaningful information for us to maybe try and help fix the problem.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...