Jump to content

Need a bit of guiding with an idea


blink359

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.

Archived

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

×
×
  • 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.