Figure out what is unique about a user (what makes it definate that a user is a duplicate) and make a unique index on that field or fields. Assuming you want a unique username:
insert ignore into user (username, blah) values ('blah', 'blah')
This will make the insert if the username is different from any other, and not return an error if not.
If you are trying to respond afterwards based on the existance of the username or not, use (assuming mysql):
if (!mysql_query("insert ignore into user (username, blah) values ('blah', 'blah')")) {
print "The username exists";
}
mysql_query returns false if there was a problem with the sql.