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!

if - else if - else if - confused

Status
Not open for further replies.

leeolive

Programmer
May 14, 2002
46
0
0
GB
Hi

I can't seem to get this working, if anyone has any idea..

I need to do the following:

if str = "" or str = "" or str = "" then
print this table saying - please complete form

else
set up the connection and retrieve all data where NI = NI or UN = UN or PW = PW OR Email = Email

if no records found then user not in db so submit to db

else if records found then (check individually for which record has been found)

if NI = rsNI then
print this table saying you are already registered

else if UN = rsUN then
print this table saying enter a different UN

else if PW = rsPW then
print this table saying enter a different PW

else if Email = rsEmail then
print this table saying email already in use

<%end if%>
<%end if%>

Should I use a select case here? Confused.
Thanks Lee
 
if str=&quot;a&quot; or str=&quot;b&quot; or str=&quot;c&quot; then
printForm()
else
set rs = cn.execute(&quot;select * from myTable where ni = '&quot; & ni & &quot;' or un = '&quot; & un & &quot;' or email = '&quot; & email & &quot;'&quot;)
if rs.eof then
cn.execute(&quot;INSERT myTable VALUES('&quot; & ni & &quot;','&quot; & email & &quot;'&quot;)
else
if rs(&quot;ni&quot;) = ni then
printRegistered()
elseif rs(&quot;un&quot;) = un then
printDiffUN()
else
printBadEmail()
end if
end if

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Thanks, appreciate it! Going to give it a go now...
Cheers
Lee
 
Hi there

It keeps on saying expected end line 1508 which ir at the bottom

I have done exactly as you said but have response.end before <%else%> (see below in caps). This stops this page from submitting to the db when the first if is performed. I also close the body and html tags after the <%end if's%> at the end. Why would it be doing this? My code is so incredible long otherwise I would post it here. Do you have any ideas? I marked my changes to your above code in caps
Thanks!

if str=&quot;a&quot; or str=&quot;b&quot; or str=&quot;c&quot; then
printForm()
RESPONSE.END
else
set rs = cn.execute(&quot;select * from myTable where ni = '&quot; & ni & &quot;' or un = '&quot; & un & &quot;' or email = '&quot; & email & &quot;'&quot;)
if rs.eof then
cn.execute(&quot;INSERT myTable VALUES('&quot; & ni & &quot;','&quot; & email & &quot;'&quot;)
else
if rs(&quot;ni&quot;) = ni then
printRegistered()
elseif rs(&quot;un&quot;) = un then
printDiffUN()
ELSEIF RS(&quot;EMAIL&quot;) = EMAIL THEN
PRINT TABLE
ELSE
printBadEmail()
end if
end if

</BODY>
</HTML>
 
if str=&quot;a&quot; or str=&quot;b&quot; or str=&quot;c&quot; then
printForm()
RESPONSE.END
else
set rs = cn.execute(&quot;select * from myTable where ni = '&quot; & ni & &quot;' or un = '&quot; & un & &quot;' or email = '&quot; & email & &quot;'&quot;)
if rs.eof then
cn.execute(&quot;INSERT myTable VALUES('&quot; & ni & &quot;','&quot; & email & &quot;'&quot;)
elseif rs(&quot;ni&quot;) = ni then
printRegistered()
elseif rs(&quot;un&quot;) = un then
printDiffUN()
ELSEIF RS(&quot;EMAIL&quot;) = EMAIL THEN
PRINT TABLE
ELSE
printBadEmail()
end if
end if

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top