Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
lucas20042004
Forum Newbie
Posts: 7 Joined: Mon May 15, 2006 7:39 am
Post
by lucas20042004 » Mon May 15, 2006 7:46 am
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
BadgerC82
Forum Commoner
Posts: 25 Joined: Tue Feb 07, 2006 6:53 am
Post
by BadgerC82 » Mon May 15, 2006 9:47 am
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]