Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

test username if existing according to dates

Status
Not open for further replies.

tinapa

Technical User
Nov 12, 2008
81
0
0
GB
hi guys, i am trying to write a registration form where you need to test first the entry of the would-be registrant before inserting into the database. do you know how to test it if a username is already existing in the database? the filters should be username, and between the dateRegistered and dateExpiry. i am using asp, sql server, dreamweaver.


sampletable1

id username password dateRegistered dateExpiry
-- --------- --------- ------------- -----------
1 username1 password1 01/28/2007 01/29/2008
2 username2 password2 02/21/2007 02/27/2008
.
.
.

or do you have any sample codes similar to this?

thnx
 
The sample code is going to depend on the server side language, and type of database you are using in conjunction with Dreamweaver.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 

hi vacunita,

i am using asp, sql server, dreamweaver.
 
Ahh ASP, unfortunately my knowledge of ASP is very limited.

However for SQl the query should be something similar to:
Code:
"SELECT username FROM sampletable1 where username=username_from_form"

If the query returns anything but zero rows, then the name has been found in the database. Which means its already in use.

If it returns 0 rows, then you know it hasn't been used
Perhaps someone with better knowledge of ASP, can put up some sample code to to get the form value into the query string.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
thnx vacunita i will look into that
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top