View Single Post
Old 01-10-2009, 09:57 AM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,426
wordpress tip: extract all comment emails for mailing

I dont recommend spamming your blog users, but sometimes you may want to send information to your readers, many of you might use a wordpress plugin for a mailing list or an external program which can import a list.

Here is a small snippet of code which will print out all your comment author's emails.

Code:
<?php

$db_host = "localhost";
$db_user = "username";
$db_password = "password";
$db_name = "database";

$connect=mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());
$db=mysql_select_db($db_name, $connect) or die(mysql_error());

$result=mysql_query("select comment_author_email from wp_comments");
while($row=@mysql_fetch_assoc($result))
{
        $email=$row[comment_author_email];
        echo $email;
}

?>
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote