Tuesday 12 July 2016

How to avoid duplicate data insertion using php and MySql

mysql-database.png

This blog will help user learn how to avoid the duplicate entries in the database. Storing duplicate values in the table must be avoided while inserting data in the database table. As these duplicate entries can create many problem in the application.

Developers go with many data insertion practice to avoid duplicate entry which are discussed as below:

1- Remove duplicate values using 'DISTINCT' key in mysql query, if it is present in table.

2- Check whether the value is present in table or not using PHP and Mysql before inserting data into the table.

3- We can also avoid duplicate values storing in mysql table while inserting by primary key.



No comments:

Post a Comment