Gossamer Forum
Home : Products : DBMan : Installation :

Comparing Fields

Quote Reply
Comparing Fields
I have a field called user_name. When a new user registers and adds their user name, I need the name compared to the rest of the user_names to make sure there are no duplications. If duplication, reject and give error message.

Can anyone offer some assistance as how to go about doing this?
Quote Reply
Re: Comparing Fields In reply to
I believe all you need to do is to set number
$auth_user_field = 9;

to match the Userid field, not the user_name field.

By default, it the Userid field is in slot 9 and you should be all set using that.
Quote Reply
Re: Comparing Fields In reply to
I am creating a membership script where each person will be able to create a user name. According to the config file (at least how I read it) ...

Quote:
# Track the key? Should DBMan keep a counter of the next key to use? This isn't
# neccessary if you can guarantee that your entry in the key field will be unique
# (i.e. a userid).
$db_key_track = 1;

I can't guarantee that someone won't unintentionally or intentionally duplicate someone else's user name; accordingly, I need a script to check the database before accepting their user name.

Quote Reply
Re: Comparing Fields In reply to
Set your $auth_user_id to whatever number your field is where you want to hold the user id. Set your $db_key to the name of that field. Set $db_key_track to 0.

The script will automatically insert the user's name into the field you set as $auth_user_field. Since two users can't have the same user id at login time, this will guarantee that each user will only have one record.



------------------
JPD
Quote Reply
Re: Comparing Fields In reply to
Alright, my guess is I'm being a little dense, but one more question. In the last response it was stated that
Quote:
Since two users can't have the same user id at login time, this will guarantee that each user will only have one record.
Because each user name needs to be unique all the time, not just when logged on, will this still work?
Quote Reply
Re: Comparing Fields In reply to
OK Everyone:

Forget everything I asked ... it's amazing what you learn when you have time to sit down and read the instructions! I think I have my questions answered for now ... but stay tuned ... I might have more! Smile