Php 插入到。。。Twitter API在哪里

Php 插入到。。。Twitter API在哪里,php,mysql,sql,twitter,Php,Mysql,Sql,Twitter,我已经将一些tweet存储到数据库中,这样我就不会受到twitter请求的限制 我想这样做: INSERT INTO `tweets` (`tweet_id` ,`date` ,`time` ,`tweet` ,`tag`)VALUES ({$tweet['link']},'$formatted_date','$formatted_time','$string','$hash') WHERE `tweet_id` < 插入'tweets'('tweet\u id'、'date'、'tim

我已经将一些tweet存储到数据库中,这样我就不会受到twitter请求的限制

我想这样做:

INSERT INTO `tweets` (`tweet_id` ,`date` ,`time` ,`tweet` ,`tag`)VALUES ({$tweet['link']},'$formatted_date','$formatted_time','$string','$hash') WHERE `tweet_id` <
插入'tweets'('tweet\u id'、'date'、'time'、'tweet'、'tag`)值({$tweet['link']}、$formatted\u date'、'$formatted\u time'、'$string'、'$hash'),其中'tweet\u id'<
我想在tweet_id<$Max的数据库中插入

其中$Max是先前的select语句,该语句从数据库检索Max tweet_id。这是为了减少重复(我厌倦了重复的
tweet\u id
found-MySQL错误)

如何实现这一点,我不能执行INSERT INTO SELECT语句,因为我不是从现有表复制,我不希望在转储表中存储我获取的所有内容,然后插入SELECT where from dump到主表。我也不希望数据库中存在重复的唯一标识符


我可以做什么工作?

您可以在重复更新时执行
插入忽略|替换|
例如,如果tweet是不可变的,则最容易使用
INSERT IGNORE
,其中具有相同id的tweet将在插入过程中被忽略

insert ignore into tweets
(tweet_id, `date`, `time`, tweet, tag)
VALUES ({$tweet['link']},'$formatted_date','$formatted_time','$string','$hash');