0

I am currently using a script to run RSS feeds and dump all data into a MySQL. Every time I run it, it creates a duplicate entry into a database. Is there any way, I can just program a script to only get new feeds?

I have some feeds subscribed on the microsoft outlook and it shows me new feeds as if its a new email. When outlook can handle such thing, I guess my script can handle it too.

3
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by HITMANOF44th
1

Both RSS 2.0 and Atom use GUID and ID to identify unique items/entries inside the feed, use those values associated with each source to check what you have already included.

Bye :)

Edited by cereal: n/a

0
mysql_query("INSERT INTO data values('$title','$link','$description','$myDate')");

Thanks for your help!

0
// check db to see if the record is there
$sql="SELECT * FROM `data` WHERE (`title` = '$title' AND `description` = '$description') AND `date` = '$mydate' ";
$result=mysql_query($sql);
//count results
$count=mysql_num_rows($result);
if($count == 0){
//if record doesnt exist add it
mysql_query("INSERT INTO data values('$title','$link','$description','$myDate')");

}
0

also i dont know what your data looks like you might want to use
addslashes(); in case it has special characters

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.