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.

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 :)

post the mysql insert part and we can probley help more

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

Thanks for your help!

// 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')");

}

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.