DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Output Feedwordpress Database For Use In Planet

04.11.2006
| 1955 views |
  • submit to reddit
        You'll need to change the initial settings as I didn't bother to read them from the Wordpress config file.  You may also need to change the table name (wp_links) in the sql query.

<?php
$username = "myuser";
$password = "P455w0rd";
$database = "db_name";
$hostname = "127.0.0.1";

$query = "SELECT link_name, link_rss FROM wp_links WHERE link_category=2";

mysql_connect($hostname, $username,$password);
@mysql_select_db($database) or die("Unable to select database");
$result = mysql_query($query);
$num = mysql_numrows($result);
mysql_close();

$i=0;
while($i < $num) {
        $rss = mysql_result($result,$i,"link_rss");
        $name = mysql_result($result,$i,"link_name");

        echo "[".$rss."]\r\n";
        echo "name = ".$name."\r\n";
        $i++;
}
?>