MySQL Forums
Forum List  »  Newbie

how to check to see if a valid entry
Posted by: William Gray
Date: July 12, 2005 08:46AM

how do you check to see if a number you are tryint to insert into your db is unique?

like this is my situation...

DB - complaint-log
TABLE - mainrecordtable
FIELDS - cn, wo, do, prob, sys, class, dc, res

the fields cn and wo need to be unique... i have them set up in the db to be unique fields....

what i need to know is how do i check to see that "CN-05-522" is not already entered into the cn field of any of the existing records... and if it is not... then continu with:

INSERT VALUES ($cn,$wo,$do,$prob,$sys,$class,$dc,$res) INTO mainrecordtable (cn,wo,do,prob,sys,class,dc,res);

but if the CN is in the db i need it to put out an error message.... and would need to check the wo field as well before the record was inserted.


help????


thanks a million in advance :)


William Gray - wgray@scottcare.com

Options: ReplyQuote


Subject
Written By
Posted
how to check to see if a valid entry
July 12, 2005 08:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.