You missed $row=mysql_fetch_assoc($check); ________________________________ From: Joe Forsythe <jforsythe@xxxxxxxxxxxxxxxxxx> To: php-objects@xxxxxxxxxxxxxxx Sent: Wed, January 13, 2010 4:22:58 PM Subject: Re: Retrieving password from database Unless I've missed it somewhere, $row[pass] doesn't really do anything. You're just setting $pass to another variable that does nothing. -- Joe On Jan 13, 2010, at 7:06 AM, doneatlast1000 wrote: > I write the script below for users to retrieve their password when > forgotten, but the echo result is not brining out the password as > it output: Your password is > > Can anyone look at the script below and help out. > > <?php > if (!empty($_POST[Submit])) > { > include ("connect.php"); > $pwquestion=$_POST[pwquestion]; > $pwanswer=$_POST[pwanswer]; > $cityob=$_POST[cityob]; > $check=mysql_query("SELECT * FROM register WHERE > pwanswer='$pwanswer' AND cityob='$cityob'"); > if(mysql_num_rows($check)==0) > echo "Invalid Check"; > else > { > > $pass=$row[pass]; > $sel=mysql_query("SELECT * FROM register WHERE pass='$pass'"); > $row=mysql_fetch_array($sel); > echo "Your Password is <b>$pass</b>"; > // The output is: Your Password is > // I need the really password($pass) to be echo out > } > } > ?> > > [Non-text portions of this message have been removed] ------------------------------------ Are you looking for a PHP job? Join the PHP Professionals directory Now! http://www.phpclasses.org/jobs/ Yahoo! Groups Links [Non-text portions of this message have been removed]