Neat wordpress trick

Extract all the emails from the comments in a wordpress blog.

I haven’t tried this yet but saw it on a webmaster forum.

<?
$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;
}

?>

If you enjoyed this post, make sure you subscribe to my RSS feed!

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)