dpiearcy Posted January 28, 2013 Share Posted January 28, 2013 This may be off topic here but it DOES contain php so.... I'm creating an XML for an RSS feed. For some reason the loop isn't working. It only shows me the last post, not the LIMIT 10. But if I run it through feedvalidator.org I see all 10. Just not in Mac Mail which I use to read RSS feeds. (just remembered after pasting the code I removed the LIMIT 10 while testing so ignore that above). Any thoughts? The loop looks fine to me. And it's showing in the validator. Or a better way of achieving this would be awesome too. $rssfeed = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $rssfeed .= '<rss version="2.0">'; $rssfeed .= '<channel>'; $rssfeed .= '<title>My Site Feed</title>'; $rssfeed .= '<link>http://www.mysite.com</link>'; $rssfeed .= '<description>News feed</description>'; $rssfeed .= '<language>en-us</language>'; $rssfeed .= '<copyright>Copyright (C) 2013 mysite.com</copyright>'; $connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to database'); mysql_select_db(DB_NAME) or die ('Could not select database'); $query = "SELECT * FROM table ORDER BY date DESC"; $result = mysql_query($query) or die ("Could not execute query"); while($row = mysql_fetch_array($result)) { extract($row); $rssfeed .= '<item>'; $rssfeed .= '<title>' . $title . '</title>'; $rssfeed .= '<description>' . $description. '</description>'; $rssfeed .= '<link>http://www.mysite.php</link>'; $rssfeed .= '<pubDate>' . date("D, d M Y H:i:s O", strtotime($date)) . '</pubDate>'; $rssfeed .= '</item>'; } $rssfeed .= '</channel>'; $rssfeed .= '</rss>'; echo $rssfeed; Thanks Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 28, 2013 Share Posted January 28, 2013 But if I run it through feedvalidator.org I see all 10. Just not in Mac Mail which I use to read RSS feeds. Sounds like the issue is your feed reader. How does it look in Google Reader? Quote Link to comment Share on other sites More sharing options...
dpiearcy Posted January 28, 2013 Author Share Posted January 28, 2013 You were right "sweetheart" ;-) (sorry...couldn't resist). Shows up just fine in google reader. Talk about making Steve Jobs roll over. He hated and wanted to destroy google and here they are reading it correctly and his mail program is not. Thanks for pointing me to google. Did not know they had this. Who has time to actually surf the net these days anyway? Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 28, 2013 Share Posted January 28, 2013 It's probably some settings you have. Usually when you first subscribe to a feed, the reader doesn't show you too many posts. Like google will always only show you the 10 most recent posts in the past, then all new ones as they appear. Try subscribing, then publishing some new posts, like 2 or 4 of them, and see if your mac feed reader shows all the new ones. Quote Link to comment Share on other sites More sharing options...
dpiearcy Posted January 28, 2013 Author Share Posted January 28, 2013 It's probably some settings you have. Usually when you first subscribe to a feed, the reader doesn't show you too many posts. Like google will always only show you the 10 most recent posts in the past, then all new ones as they appear. Try subscribing, then publishing some new posts, like 2 or 4 of them, and see if your mac feed reader shows all the new ones. I will try that. Wasn't really wanting it for the feeder in my mac mail though. Just making sure it was getting all the info I needed for my HTML5 app. Need that populated correctly for that app. So I doubt I'll mess with my reader. I don't really subscribe to stuff anyway but this seemed like the easiest way to populate the fields on the webpage to the app since I'm already populating the page from MySql info. And this is a specialized application they don't want to pay apple to put in the app store so no objective C and Xcode on this one. Thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.