Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

How to restrict Duplicate Entries in MySQL-Phpadmin

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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
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 pbs » Thu Jul 18, 2013 4:16 am

you can set unique key for any field for which you don't want repeated values
pbs
New php-forum User
New php-forum User
 
Posts: 39
Joined: Sat May 11, 2013 1:40 am
Location: Nashik, India

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
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 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.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron