FeedForAll Forum Index  
 Home  •  FAQ  •   Search   •  Register   •  Profile   •  Log in
 Truncate table before update? View next topic
View previous topic
Post new topicReply to topic
Author Message
forcedinductionz



Joined: 07 Mar 2008
Posts: 3

PostPosted: Fri Mar 07, 2008 1:36 pm Reply with quoteBack to top

I'm using multiple RSS feeds merged into a single feed, then using RSS2SQL to put them into a MYSQL db. However, I need the feed to be updated when a item is removed. I tbelieve, (correct me if I'm wrong) RSS2SQL only adds to items to the feed, and does not remove them. If I truncate the table before I update my RSS feed then it should clear any items that have been removed since my last update. Is there any easy way to add this function to the rss2sql.php?

<?php

$connection = mysql_connect('HOST', 'USER', 'PASSWORD');

mysql_select_db('DB NAME');

$sql = "TRUNCATE TABLE `DB TABLE`";

mysql_query($sql);

mysql_close($connection);

I believe this code should work, however I am unsure where to place this in php code in rss2sql.php Any help would be appeciated!
View user's profileVisit poster's website
forcedinductionz



Joined: 07 Mar 2008
Posts: 3

PostPosted: Fri Mar 07, 2008 1:37 pm Reply with quoteBack to top

BTW, here is the link to the website where I'm using the feeds http://ondahouse.com[url]
View user's profileVisit poster's website
MacSupport



Joined: 24 Feb 2005
Posts: 2805

PostPosted: Sat Mar 08, 2008 8:12 am Reply with quoteBack to top

forcedinductionz wrote:
I'm using multiple RSS feeds merged into a single feed, then using RSS2SQL to put them into a MYSQL db. However, I need the feed to be updated when a item is removed. I tbelieve, (correct me if I'm wrong) RSS2SQL only adds to items to the feed, and does not remove them. If I truncate the table before I update my RSS feed then it should clear any items that have been removed since my last update. Is there any easy way to add this function to the rss2sql.php?

<?php

$connection = mysql_connect('HOST', 'USER', 'PASSWORD');

mysql_select_db('DB NAME');

$sql = "TRUNCATE TABLE `DB TABLE`";

mysql_query($sql);

mysql_close($connection);

I believe this code should work, however I am unsure where to place this in php code in rss2sql.php Any help would be appeciated!


It might not work as well as you think because not all feeds are updated at the same time. However this might work okay. Currently at line 867 is:
Code:
FeedForAll_database_query($config, 'INSERT INTO '.$config['ItemTable'].' ('.$fields.') VALUES ('.$values.')');


If that were modified to be something like this:
Code:

FeedForAll_database_query($config, 'DELETE FROM '.$config['ItemTable'].' WHERE '.$config['feedID'].'='.$feedID);

FeedForAll_database_query($config, 'INSERT INTO '.$config['ItemTable'].' ('.$fields.') VALUES ('.$values.')');


That will only delete items from the feed it is updating.

Jim

_________________
Be sure to check out the FeedForAll Mac tutorials at: http://www.FeedForAll.com/tutorials/

FeedForAll Mac and rss2html.php
support@FeedForAll.com
View user's profileVisit poster's website
forcedinductionz



Joined: 07 Mar 2008
Posts: 3

PostPosted: Sun Mar 09, 2008 1:18 am Reply with quoteBack to top

Jim,

I think your solution is going to work just fine. Thanks for your help!
View user's profileVisit poster's website
stevejoe



Joined: 21 Dec 2009
Posts: 4

PostPosted: Fri Dec 25, 2009 3:08 pm Reply with quoteBack to top

I think you can better make a trigger, so you can use update keyword.
View user's profile
stevejoe



Joined: 21 Dec 2009
Posts: 4

PostPosted: Sun Dec 27, 2009 6:22 am Reply with quoteBack to top

forcedinductionz wrote:
BTW, here is the link to the website where I'm using the feeds http://ondahouse.com[url]


The URL is not working
View user's profile
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme