Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
此代码:将始终插入行,从不检测存在
$r = mysql_query("INSERT IGNORE INTO facebook (uid,fid) VALUES ('".$_SESSION['id']."','".$persone['id']."')") or die(mysql_error());
为什么?
编辑:请不要,输入值总是相同的
INSERT IGNORE仅适用于主键字段。如果您的facebook表没有设置主键,您可以这样做:
INSERT IGNORE
facebook
alter table facebook add primary key (uid)
在此之后,INSERT IGNORE不会插入重复的行。