PDA

View Full Version : Does your email exist?


Peterpan
01-09-2003, 07:35 AM
I got this sigup form on submit I need it to check into the DB to see if the email address as been used by another member. and if used go back to the signup page and tell the guy about it.

I tryed to do it but I'm getting error


...
dim objc, objrs
set objc = server.createobject("adodb.connection")
objc.open "DSN"
set objrs = server.createobject("adodb.recordset")
objrs.activeconnection = objc
set objrs = objc.Execute("SELECT * FROM members WHERE email='"&email&"'")
if email = objrs.fields("email") then
objrs.close
Set objrs = Nothing
response.redirect "signup.asp?address=Used&email="&email

else
...

glenngv
01-09-2003, 07:47 AM
why do you need to compare the email against the retrieved email from db when you already have the WHERE clause that retrieves records that have the same email.

you just want to check if the sql statement contains records or not:

if not objrs.EOF and not objrs.BOF then
'email already exists
else
'email doesn't exist
end if

Peterpan
01-09-2003, 08:00 AM
Thanks man