prob in primary key

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
madu
Forum Commoner
Posts: 32
Joined: Sat Dec 25, 2010 3:19 am
Location: india

prob in primary key

Post by madu »

hi friends,,,,
this is my table creation query,,,,
////
mysql_query("create table logg(fname varchar(20),lname varchar(20),pwd varchar(20),mnum varchar(20),hnum varchar(20),eid varchar(35),primary key(fname,eid))

////
i set fname and eid as primary key,,,, while i inserting already existing 'eid' it shows exception but when i am insert already existing 'fname' the executed suceddfully,,, i doesn't show exception,,, why
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: prob in primary key

Post by Darhazer »

Exception is only if both fname and eid exists in the same record
example
fname | eid
abcde | 123
abcde | 234 - ok
bcdef | 123 - ok
abcde | 123 - exception
Post Reply