0

getting the problem ~
mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /studhome/1/0803087/public_html/RSS.php on line 14

trying to create a RSS feed
no idea what is wrong, so can anyone help

<?
// Connect to database
DEFINE ('DB_USER', '******'); 
DEFINE ('DB_PASSWORD', '********'); 
DEFINE ('DB_HOST', '*****'); 
DEFINE ('DB_NAME', '******');

// Get latest items from db
$sql = "SELECT Name FROM Games ORDER BY date_added DESC limit 0,10";
$rst = mysql_query($sql);

// Loop through data and build feed items
$items = "";
while($a_row = mysql_fetch_assoc($rst))
{
$items.= "<item>";
$items.= " <title>{$a_row['title']}</title>";
$items.= " <link>{$a_row['link']}</link>";
$items.= " <description>{$rst['description']}</description>";
$items.= "</item>"; 
}

// Build feed text
$feed = "<?xml version=\"1.0\"?>";
$feed.= "<rss version=\"2.0\">";
$feed.= " <channel>";
$feed.= " <title>My cool feed</title>";
$feed.= " <link>http://www.dude.com/</link>";
$feed.= " <description>A cool feed</description>";
$feed.= " $items";
$feed.= " </channel>";
$feed.= "</rss>";

// Display feed text
echo $feed;
?>
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by XxPKMNxX
0

You have to establish a connection first with mysql_connect().
Try

$rst = mysql_query($sql) or die(mysql_error());

to learn more about the problem.

Edited by smantscheff: n/a

0

Thanks! Duhhh that helped, i actually put that in, then took it out for some reason. Amateur mistake :yawn:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.