I's me again , did you missed me folks?[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:7. Do not divulge anyone's personal information in the forum - including your own. This includes e-mail addresses, IP addresses, age, house address, and any other individual information.
I have this code to generate the RSS for the last 10 posts
Code: Select all
<?php
$xml = "<?xml version="1.0" encoding="UTF-8"?>";
$xml .= <<<doc
<rss version="2.0">\n
<title> Title is here </title>\n
<link> link is here </link>\n
<description>description is here</description>\n
doc;
$link = mysql_connect('mysql.host.address','username','password') or die('Database connection Error!!');
mysql_select_db('databasename');
$query = "Select projectname,
ownerid,
pricemax,
dateposted,
timeposted,
timestamp(dateposted,timeposted) as 'when'
from projects
order by 'when' DESC LIMIT 10;";
$result_set = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($result_set)) {
$xml .= <<<_XML_
<Item>\n
<Title>$row[projectname]</Title>\n
<description>Description</description>\n
<link>test linb</link>\n
<username>$row[ownerid]</username>\n
<max_price>$row[pricemax]</max_price>\n
<Date_posted>$row[dateposted]</Date_posted>\n
<Time_posted>$row[timeposted]</Time_posted>\n
</Item>\n
_XML_;
}
mysql_free_result($result_set);
mysql_close($link);
$xml .= "</rss>";
$rss_file = simplexml_load_string($xml);
// change the path to $_SERVER['DOCUMENT_ROOT']
$rss_file->asXML('/home/content/p/i/c/pickageek/html/');
?>You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(dateposted,timeposted) as 'when' from projects order
What can be wrong?
EDIT: Onion - Replaced MySQL server details with dummy data.