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;
}
?>
:thumbsup
|