## for loop dilemma

I&#039;m using nested for loop to show options selected for a product.<BR><BR>to modify a product - show options which were selected earlier, and add new options which might be selected at the time of modifying product. <BR><BR>Problem is options which are selected earlier are showing twice, its true for both conditions. One when both arrays are equal and other when both are not equal. Obviously my logic is wrong... <BR>Can someone please helpme out with this?I&#039;d greatly appreciate any help.<BR><BR>below is my code:<BR>pc = session("pc")<BR>pid = Request.form("pkgid")<BR><BR>set rs=Conn.execute("SELECT * from products where prodcode = &#039;" & pc & "&#039;")<BR>pkg = rs("pkgid")<BR>pkgmod = rs("pkgmodnum")<BR><BR>arrpk = split(pkg, ", ", -1, 1)<BR>arrp = split(pid, ", ", -1, 1)<BR><BR>count = 1<BR>for pk = lbound(arrpk) to ubound(arrpk)<BR><BR> for p = lbound(arrp) to ubound(arrp)<BR> if arrp(p) = arrpk(pk) then<BR> Response.Write "&#060;tr&#062;&#060;td width=330 valign=top&#062;&#060;font face=arial helvetica size=-1&#062;"<BR> set rsp=Conn.execute("SELECT * from pkg where pkgid = " & CInt(arrp(p)) ) <BR> Response.Write "first" & count & "" & rsp("pkgName") & "&#060;/font&#062;&#060;/td&#062;"<BR> count = 0<BR> <BR> elseif arrp(p) &#060;&#062; arrpk(pk) and count = 0 then<BR> <BR> Response.Write "&#060;tr&#062;&#060;td width=330 valign=top&#062;&#060;font face=arial helvetica size=-1&#062;"<BR> set rsp=Conn.execute("SELECT * from pkg where pkgid = " & CInt(arrp(p)) ) <BR> Response.Write "second" & count & "" & rsp("pkgName") & ""<BR> Response.Write "&#060;/font&#062;&#060;/td&#062;&#060;td width=170 valign=top&#062;&#060;input type=text name=model size=15&#062;&#060;/td&#062;&#060;/tr&#062;"<BR> <BR> end if<BR> next<BR>next