Russia Posted October 1, 2009 Share Posted October 1, 2009 Hello I currently have this php script that when a person registers they get added to a database. Code: <?php $date2 = date("F j Y"); $ip = $_SERVER['REMOTE_ADDR']; require("inc/config.php"); $sql="INSERT INTO persons (Username, Password, Ip, AddedDate) VALUES('$_POST[username]','$_POST[Password]','$ip','$date2')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "Thank You for registering."; mysql_close() ?> What I would like to add is send email to admin when a user registers. The Admin email address is in the Table named: members The column name is: email and the id of the admin is: 1 Basicly the 'Send To:' email address I want to be sent to the email address that the admin has in the mysql database and fetch it. Anyone know how to add it? Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 1, 2009 Share Posted October 1, 2009 select email from members where id=1... Quote Link to comment Share on other sites More sharing options...
mike12255 Posted October 1, 2009 Share Posted October 1, 2009 so you want to get the admins email from a database and send an email to it? Quote Link to comment Share on other sites More sharing options...
Russia Posted October 1, 2009 Author Share Posted October 1, 2009 Yes mate. I hope someone can post a snippet and help me out greatly. I have no idea how to. Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 1, 2009 Share Posted October 1, 2009 I gave you the query to do. You obviously know how to do queries from your original code... Quote Link to comment Share on other sites More sharing options...
Russia Posted October 1, 2009 Author Share Posted October 1, 2009 I really do not know how to honestly. Can you help me integrate it into this script? <?php $to = "you@yoursite.com"; $subject = "New Registred User"; $from = $_REQUEST['email'] ; $message = "A new user has signed up and has been added to the database"; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; ?> I want the '$to' email address to be fetched from the database. Quote Link to comment Share on other sites More sharing options...
Russia Posted October 1, 2009 Author Share Posted October 1, 2009 Bump. Quote Link to comment Share on other sites More sharing options...
Russia Posted October 1, 2009 Author Share Posted October 1, 2009 Another Bump. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.