Jump to content

Recommended Posts

Hello,

I am looking to create a form in which it gets a list of peoples emails from a database and then emails all of them via the web form. I am not sure how to do this so can someone give me a bit of guiding or show me somewhere on the internet or forum post that i can read up on this.

 

Thank you

 

Blink359

Link to comment
https://forums.phpfreaks.com/topic/208390-need-a-bit-of-guiding-with-an-idea/
Share on other sites

Thanks for these sites, the one thing im not quite understanding is how im going to get all the emails out of the database and into the layout that i need for the email script,

the database format is Name, Email. So i want to select all the email's out and then into a variable that i can put into the script, would i be able to get them all out as an array and then put that array variable into the reciepitants part of the script? (Hopefully that makes sense)

 

Thanks

 

Blink359

Using MySQL functions you can extract each row from a table and it will be stored in an array. You can then use a while loop to loop through every row in the database and put it into an array, then use that array however you choose.

 

Example:

<?php
$result = mysql_query("SELECT name, email FROM mailinglist");

while ($row = mysql_query($result)) {
  echo $row['name'] . '<br />';
  echo $row['email'] . '<br />';
}
?>

 

That will list all of the names and e-mail addresses stored in the database.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.