How would I do this??

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
lucas20042004
Forum Newbie
Posts: 7
Joined: Mon May 15, 2006 7:39 am

How would I do this??

Post by lucas20042004 »

Hi, how would I do this:

I want to make a blank page with a link. But when you click the link it gathers every email address that is in a table on my mysql database and copys them into my email client ready for sending an email? Thanks
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
BadgerC82
Forum Commoner
Posts: 25
Joined: Tue Feb 07, 2006 6:53 am

Post by BadgerC82 »

Hi,

One solution would be to select all the emails out and then put them in a mailto link... ie.

Code: Select all

<a href="mailto: someone@something.com; someone2@something.com">my link</a>
You could do this with:

Code: Select all

$query = "SELECT email_address FROM my_contacts";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);

for($i = 0l $i < $num_rows; $i++)
{
     $email_addresses = $row->email_address;
     if($i + 1 != $num_rows){
          $email_address .= ",";
     }
}

$link = "<a href=\"mailto: $email_addresses\">my link</a>";
:)[/quote]
Post Reply