youlichika
13 Jan 2011, 06:54 PM
I have ordered yahoo news rss, I use simplepie to separate the news items like title, content, url, date... and then insert them into database. I catch the source every 2 hours with cron. How to judge RSS source, if there has new then UPDATE into database?
I mean if the rss source has 10 items, 5 are old, 5 are new, I want just update the 5 items new and ignore the 5 old items. I do not want insert the repeart items.
And I want to get `echo` a list of the 5 new items.
This is my insert code.
mysql_select_db("rss",$db1);
mysql_query("INSERT INTO yahoonews (link, title, date, content, image, imagelink) VALUES ('".$link."', '".$title."', '".$date."', '".$content."', '".$image."', '".$imagelink."')");
I mean if the rss source has 10 items, 5 are old, 5 are new, I want just update the 5 items new and ignore the 5 old items. I do not want insert the repeart items.
And I want to get `echo` a list of the 5 new items.
This is my insert code.
mysql_select_db("rss",$db1);
mysql_query("INSERT INTO yahoonews (link, title, date, content, image, imagelink) VALUES ('".$link."', '".$title."', '".$date."', '".$content."', '".$image."', '".$imagelink."')");