How to restrict Duplicate Entries in MySQL-Phpadmin

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

stephenrodrics
New php-forum User
New php-forum User
Posts: 58
Joined: Thu Mar 14, 2013 6:10 am

How to restrict Duplicate Entries in MySQL-Phpadmin

Postby stephenrodrics » Thu Jul 18, 2013 4:09 am

Hi All,

I am using Xampp server and MYSQL as database, i am noticing that some Duplicate entries are getting created in MYSQL.

How can I restrict this duplicate entries.


My code is written in PHP.

Thanks

pbs
New php-forum User
New php-forum User
Posts: 39
Joined: Sat May 11, 2013 1:40 am
Location: Nashik, India
Contact:

Re: How to restrict Duplicate Entries in MySQL-Phpadmin

Postby pbs » Thu Jul 18, 2013 4:16 am

you can set unique key for any field for which you don't want repeated values

stephenrodrics
New php-forum User
New php-forum User
Posts: 58
Joined: Thu Mar 14, 2013 6:10 am

Re: How to restrict Duplicate Entries in MySQL-Phpadmin

Postby stephenrodrics » Thu Jul 18, 2013 5:46 am

unfortunately I cannot do that.

as this is a timesheet system and many employees fill there timesheet on same date, so I have to allow duplicate values as Date

is there anything I am missing in PHP MyADMin settings

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: How to restrict Duplicate Entries in MySQL-Phpadmin

Postby johnj » Thu Jul 18, 2013 8:42 pm

if you cannot set a key then you have to manually check for duplicates before you insert any new record to the table.


Return to “PHP coding => General”

Who is online

Users browsing this forum: landi and 1 guest