Hi,
Say for example my db is named: testdb
with a table called: testtbl
I would like it so if a user fills out a form, the ASP page checks to see if the email entered is in the db then checks along that record to see if "wantsinfo" is set to "ON" then if all of that is true redirects them to found.htm and if false or found email but "wantsinfo" is set to "OFF" adds the new record.
See below:
<%
email=request.form("email"
wantsinfo=request.form("wantsinfo"
Set dbconnection = Server.CreateObject("ADODB.Connection"
dbconnection.open "DSN=testdb"
Set RS_Users = Server.CreateObject("ADODB.Recordset"
RS_Users.ActiveConnection = dbconnection
RS_Users.Source = "testtbl"
RS_Users.CursorType = 1
RS_Users.CursorLocation = 2
RS_Users.LockType = 2
RS_Users.Source = "testdb"
SQL_Users = "Select * from testtbl where email = '" & email1 & "'"
SQL_Users = "Select * from testtbl where wantsinfo = "ON"
RS_Users.Open SQL_Users
If RS_Users.eof then
RS_Users.AddNew
RS_Users("email" = email
RS_Users("wantsinfo" = wantsinfo
RS_Users.Update
else
response.redirect("found.htm"
end if
RS_Users.close
Set RS_Users=Nothing
dbconnection.close
%>
Where am I going wrong?
Thanks for any help you could give me
--Tim
Say for example my db is named: testdb
with a table called: testtbl
I would like it so if a user fills out a form, the ASP page checks to see if the email entered is in the db then checks along that record to see if "wantsinfo" is set to "ON" then if all of that is true redirects them to found.htm and if false or found email but "wantsinfo" is set to "OFF" adds the new record.
See below:
<%
email=request.form("email"
wantsinfo=request.form("wantsinfo"
Set dbconnection = Server.CreateObject("ADODB.Connection"
dbconnection.open "DSN=testdb"
Set RS_Users = Server.CreateObject("ADODB.Recordset"
RS_Users.ActiveConnection = dbconnection
RS_Users.Source = "testtbl"
RS_Users.CursorType = 1
RS_Users.CursorLocation = 2
RS_Users.LockType = 2
RS_Users.Source = "testdb"
SQL_Users = "Select * from testtbl where email = '" & email1 & "'"
SQL_Users = "Select * from testtbl where wantsinfo = "ON"
RS_Users.Open SQL_Users
If RS_Users.eof then
RS_Users.AddNew
RS_Users("email" = email
RS_Users("wantsinfo" = wantsinfo
RS_Users.Update
else
response.redirect("found.htm"
end if
RS_Users.close
Set RS_Users=Nothing
dbconnection.close
%>
Where am I going wrong?
Thanks for any help you could give me
--Tim