|
Author |
Message |
Iyonix
WebHelper


Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England
|
Posted:
Wed Mar 12, 2003 6:41 pm (22 years, 1 month ago) |
  |
I have a mySQl table with a list of usernames and passwords in it. When a user registers I want it to check if a user of that name is allready in the database. How would I do this?
Regards, |
________________________________ Iyonix |
|
    |
 |
adam
Forum Moderator & Developer

Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Wed Mar 12, 2003 6:49 pm (22 years, 1 month ago) |
  |
first select data from the database where the username = whatever the user requested as their username. Then use mysql_fetch_row() or mysql_fetch_array() to see if the result == NULL. if it does, then continue and create the account. if not, give the user an error. |
________________________________ It's turtles all the way down... |
|
     |
 |
Daniel
Team Member


Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Wed Mar 12, 2003 6:55 pm (22 years, 1 month ago) |
  |
Or you could do what adam suggested and then use mysql_num_rows to see if there is more than 0 rows... |
________________________________
 |
|
    |
 |
adam
Forum Moderator & Developer

Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Wed Mar 12, 2003 7:02 pm (22 years, 1 month ago) |
  |
thinking about it, I like daniel's idea better using mysql_num_rows() would look neater. |
________________________________ It's turtles all the way down... |
|
     |
 |
Iyonix
WebHelper


Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England
|
Posted:
Wed Mar 12, 2003 7:07 pm (22 years, 1 month ago) |
  |
Thanks  |
________________________________ Iyonix |
|
    |
 |
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.170191 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |