3 Replies - 667 Views - Last Post: 04 August 2009 - 08:28 AM

#1 aydinz  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 46
  • Joined: 11-March 09

dynamic rss Feed

Posted 03 August 2009 - 03:59 AM

hi i want to be able to read a description and a title etc from a database to be displayed as an RSS feed,

theres no errors but i added some example text in the tables on the database but they dont sure up on the RSS feed

any help??
thanks


<?php

$DBConnect = mysql_connect('localhost','root','root');


mysql_query("SELECT * FROM rssfeedTest");

if(!mysql_select_db('rssfeedTest',$DBConnect))
die("<p><h1>The database is not available.</h1></p>");
?>


<rss version="2.0">
<channel>
<title>SwinField</title>
<description></description>
<link>http://localhost/testRSS/rss_version2.xml</link>
<copyright>Aydin Ukur</copyright>

<?php
$q= "SELECT id,title,body,UNIX_TIMESTAMP(pubDate) AS pubDate
FROM articles LIMIT 0,15 ORDER BY pubDate DESC";
$doGet=mysql_query($q);

while($result = mysql_fetch_array($doGet)){
?>
	 <item>
		<title> <?=htmlentities(strip_tags($result['title'])); ?></title>
		<description> <?=htmlentities(strip_tags($result['body'],'ENT_QUOTES'));?></description>
		<link>http://localhost/testRSS/rss_version2.xml=<?=$result['id'];?></link>
		<pubDate> <?=strftime( "%a, %d %b %Y %T %Z" , $result['pubDate']); ?></pubDate>
	 </item>  
	 
<?php } ?>  


</channel>
</rss>




Is This A Good Question/Topic? 0
  • +

Replies To: dynamic rss Feed

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: dynamic rss Feed

Posted 03 August 2009 - 07:15 AM

Have you tried adding echo mysql_error(); to see if there is actually an error with the query??

Considering you say that there is no error (which there should be, from mysql_fetch_array), I will assume that this is not the problem. However, if error_reporting is infact turned off, you would not see any error.
Was This Post Helpful? 0
  • +
  • -

#3 aydinz  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 46
  • Joined: 11-March 09

Re: dynamic rss Feed

Posted 03 August 2009 - 04:43 PM

i tried that these still no error, the RSS Feed loads up it just doesnt display any of the data i have entered in my local mysql database so like you said its something got to do with the mysql_fetch_array

any help?
Was This Post Helpful? 0
  • +
  • -

#4 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,604
  • Joined: 20-January 09

Re: dynamic rss Feed

Posted 04 August 2009 - 08:28 AM

Have you considered merely doing a SELECT * FROM articles and make sure that that works first. Then move it on to limits and other sorting features?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1