Best way to avoid duplicate entry into mysql database

后端 未结 4 1100
孤街浪徒
孤街浪徒 2020-11-22 09:53

I have a table with 3 columns - id (pk), pageId (fk), name. I have a php script which dumps about 5000 records into the table, with about half being duplicates, with same pa

4条回答
  •  悲&欢浪女
    2020-11-22 10:32

    You can also ignore the error with mysql: INSERT IGNORE INTO TABLE ... it will ignore the key error, skip over that insert and move on to the next.

提交回复
热议问题