![]() |
|
#1
|
|||
|
|||
how to prevent duplicate entries in mysql?hi,
there is mysql table patients with id auto_increment, name and faher/name, how i can prevent duplicate entries for the same patient with name and fahter/name? thanks i dvanced for your help. __________________
http://www.shams.at.tt |
|
#2
|
||||
|
||||
Re: how to prevent duplicate entries in mysql?Something like this perhaps? By creating a UNIQUE index on both columns, first_name and fathers_name?
Code:
|
|
#3
|
|||
|
|||
Re: how to prevent duplicate entries in mysql?there will be some patients that will have the same names and some of them will have the same father names the script should not prevent the same names or fahter names but the on they have exactly the same name and father name.
__________________
http://www.shams.at.tt |
|
#4
|
||||
|
||||
Re: how to prevent duplicate entries in mysql?how about giving a small example of the data you expect to see...
...and maybe a small example piece of the table data? __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#5
|
||||
|
||||
Re: how to prevent duplicate entries in mysql?If you created the DB table like I suggested, you can insert rows of patients like this:
Code:
AS you can see, you can have many patients with Ali as thier father's name. And many, with Zeshan as their first name. Of course, you may not insert another Zeshan Ali for example. But in reality, it is entirely possible for 2 people to have the same first name and last (father's) name. A much better way to structure this database table, is to use a unique identifier such as one supplied by the government i.e. an identification card, national registration card or passport number. |
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MySQL in cygwin | Avalon12 | C++ Forum | 0 | 01-Oct-2006 09:22 |
| Cpanel downgrade MYSQL 4.1.X to MySQL 4.0.xx | Webhosting-live | Web Hosting Forum | 1 | 01-Sep-2006 02:54 |
| CPanel 10, Unlimited Emails, Unlimited Subdomains, Unlimited MySQL. $2.00 per Month | Kalypsoweb | Web Hosting Advertisements & Offers | 0 | 30-Oct-2005 01:51 |
| Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More | EyotaHosts | Web Hosting Advertisements & Offers | 0 | 28-Jun-2003 13:54 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The