i’m going to archive my tweets in a database. but what i’ve done is written a PHP script which goes and grabs the latest 200 tweets from a user (me) and then will insert them into the database. This PHP script is going to run on a Cron Job but what i’m confused about is how to avoid having duplicate tweets being put into the database. The structure was going to be table: User, then two columns, ID and Tweet. So how would i get the PHP to avoid putting in duplicate tweets that it, say, put in the day before?
Thanks
Assuming the Twitter API provides a unique tweet ID, you can set that field as
UNIQUEon your database. When you try to insert a tweet which ID is already present, the insertion won’t occur.