Hi,

how can I import database file (.sql) to my database in phpmyadmin and ignore or replace duplicate fields. For example, if I have news with id 5 in .sql file and my local database, I want to replace that record in local database with record in file. I tried using Import tab but there is no option like this and it gave me error

#1062 - Duplicate entry '1' for key 'PRIMARY'

Thanks in advance,

Amer

There is a REPLACE statement in mysql with similar meaning as INSERT except that rows with duplicate keys will be deleted before the insertion. The alternative is the INSERT IGNORE statement which will skip any new rows with duplicate keys.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.