PHP + MYSQL: Check whether the inserted data is repeated. how can this problem be solved?-php Tutorial

Source: Internet
Author: User
PHP + MYSQL insert data check repeated PHP + MYSQL insert data check whether repeated data is imported from excel others newly imported may be imported with existing data duplicated PHP-ExcelReader ------ solution ------------------ modify the data table: set fields that you think may have repeated fields as "UNIQUE" indexes to avoid repeated PHP + MYSQL data insertion check
PHP + MYSQL insert data check whether repeated data is imported from excel. others may use PHP-ExcelReader to import new data.

------ Solution --------------------
Just modify the data table:
Set the fields that you think may already exist as "UNIQUE" indexes to avoid repeated fields.

------ Solution --------------------
Select count (*) from tbl_name group by does not allow repeated fields

If the result is greater than 1, it indicates that there are duplicates.
------ Solution --------------------
The filename field in the table already contains duplicate data. An error occurred while creating the unique index.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.