Handling duplicates in db

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
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Handling duplicates in db

Post by klevis miho »

I have this db structure:
CREATE TABLE domain_table(
id INT NOT NULL AUTO_INCREMENT,
domain VARCHAR(255) NOT NULL,
user_id INT NOT NULL,
)

How can I make an INSERT query (without checking with a SELECT before) which adds a unique domain for a user_id?
Post Reply