edsalin Posted August 26, 2009 Share Posted August 26, 2009 Hello everyone!! Need help with this little piece of code to retrive a password from a MySQL database and send it to the users email, it checks if the e-mail exists and outputs the correct statement, but if the e-mail does exist it goes straight to the "Sorry please try again later" and does not send the e-mail.....any ideas? //retrieve password function retrieve($email){ $stmt = "select * from members where primary_email = '$email'"; $re = mysql_query($stmt, $this->link->link); if(mysql_num_rows($re)==0) return "Sorry, this email address is not in our database"; else{ $row = mysql_fetch_assoc($re); //do email $to = $email; $subject = "Your password for member area"; $message ="Hi ".$row['first_name'].",\n\nYour password to members area is following:\n\n".$row['password']. $header = "From: [email protected]/r/n"; if (mail($to, $subject, $message, $header)) return "Your password is on the way to your email address"; else return "Sorry, please try again later."; } } Link to comment https://forums.phpfreaks.com/topic/172031-password-retrieval-from-mysql-database/ Share on other sites More sharing options...
edsalin Posted August 27, 2009 Author Share Posted August 27, 2009 bump...anyone, at least let me know if you need more code or if you see something funny in the code... please please Link to comment https://forums.phpfreaks.com/topic/172031-password-retrieval-from-mysql-database/#findComment-907690 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.