comparing value in database

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
gecko
Forum Commoner
Posts: 34
Joined: Thu Oct 24, 2002 3:45 am

comparing value in database

Post by gecko »

when user enters value, i would like to check whether this value is already present in database and if so return message that the value is already present and then break the entire code, to ensure that the value is not written to the database further down in the code.

any suggestions

thanks
nutstretch
Forum Contributor
Posts: 104
Joined: Sun Jan 11, 2004 11:46 am
Location: Leicester

Post by nutstretch »

is this field a unique ID field?

I would do a select statement to see if it returned a record with that value and then use an if statement depending what the result was.

Hope this helps
Post Reply