Page 1 of 1

HELP RSS Page with multiple table

Posted: Sun Jul 12, 2009 11:07 pm
by lioney
Hallo all,

I need help regarding creating 1 rss page that query more than 1 table and display as 1 rss page.

here is my query. This query only select columns from 1 table only and has no error.

<?php

$database = "databasename";
$dbconnect = mysql_pconnect('localhost','root','password' );
mysql_select_db($database, $dbconnect);

$query = "select title, description, date_posting, cat_id, posting_id, title, description, date_posting, cat_id, posting_id from post_merchandise where `date_expire` > '".date("Y-m-d H:i:s")."' AND country=266 order by date_posting desc";
$result = mysql_query($query, $dbconnect);

while ($line = mysql_fetch_assoc($result))
{
$return[] = $line;
}

$now = date("D, d M Y H:i:s T");

$output = "<?xml version=\"1.0\"?>
<rss version=\"2.0\">
<channel>
<title>Title RSS</title>
<link>http://www.tracypeterson.com/RSS/RSS.php</link>
<description>localhost rss</description>
<language>en-us</language>
<pubDate>$now</pubDate>
<lastBuildDate>$now</lastBuildDate>
<docs>http://localhost</docs>
<managingEditor>localhost</managingEditor>
<webMaster>localhost</webMaster>
";

foreach ($return as $line)
{
$output .= "<item><title>".htmlentities($line['title'])."</title>";
$output .= "<link>http://localhost/index.php?do=detailpag ... ])."</link>";
$output .= "<description>".htmlentities(strip_tags($line['description']))."</description></item>";
}
$output .= "</channel></rss>";
header("Content-Type: application/rss+xml");
echo $output;
?>



I got error on this query. I need help on this. I select column from more than 1 table and i received an error. could anyone help me on this?

<?php

$database = "databasename";
$dbconnect = mysql_pconnect('localhost','root','password' );
mysql_select_db($database, $dbconnect);
$query = "select post_merchandise.title, post_merchandise.description, post_merchandise.date_posting, post_merchandise.cat_id, post_merchandise.posting_id, post_personals.title, post_personals.description, post_personals.date_posting, post_personals.cat_id, post_personals.posting_id
from post_merchandise, post_personals where `post_merchandise.date_expire` > '".date("Y-m-d H:i:s")."' AND post_merchandise.country=266 AND post_merchandise.country=post_personals.country order by post_merchandise.date_posting desc";
$result = mysql_query($query, $dbconnect);

while ($line = mysql_fetch_assoc($result))
{
$return[] = $line;
}

$now = date("D, d M Y H:i:s T");

$output = "<?xml version=\"1.0\"?>
<rss version=\"2.0\">
<channel>
<title>Title RSS</title>
<link>http://www.tracypeterson.com/RSS/RSS.php</link>
<description>localhost rss</description>
<language>en-us</language>
<pubDate>$now</pubDate>
<lastBuildDate>$now</lastBuildDate>
<docs>http://localhost</docs>
<managingEditor>localhost</managingEditor>
<webMaster>localhost</webMaster>
";

foreach ($return as $line)
{
$output .= "<item><title>".htmlentities($line['title'])."</title>";
$output .= "<link>http://localhost/index.php?do=detailpag ... ])."</link>";
$output .= "<description>".htmlentities(strip_tags($line['description']))."</description></item>";
}
$output .= "</channel></rss>";
header("Content-Type: application/rss+xml");
echo $output;
?>