Hi, I have this code I'm trying to modify, but I just cant seem to find a way to get around it
, hope someone can help here.
What I have is part of the code that does the drop down menu of all my categories & subcategories. I need it just to show only level 1 of my catgories in the drop down menu.
What it shows in the drop down menu right now
Bag-backpack
Bag-clutch
Shoes-sandals
Shoes-boosts
I want it to show only
Bag
Shoes
===========================================
Here is the code I have
=============================================
<% ' get leaf categories from db
mySQL="SELECT idcategory,categoryDesc FROM categories WHERE idparentcategory=1 AND idCategory>1 AND iBTOhide=0 ORDER BY categoryDesc"
set rs=conntemp.execute(mySQL)
%>
<select name="idcategory">
<option value='0'>
<%response.write dictLanguage.Item(Session("language")&"_advSrca_4")%>
</option>
<% Do While NOT rs.EOF
'check to see if catagory has subcategories
strSQL="SELECT idcategory,categoryDesc FROM categories WHERE idParentCategory="& rs("idCategory")
set rs2=server.CreateObject("ADODB.Recordset")
set rs2=conntemp.execute(strSQL)
if rs2.eof then
subVar="1"
Else
do while NOT rs2.eof
strSQL="SELECT idcategory,categoryDesc FROM categories WHERE idCategory="& rs2("idCategory")
dim rs3
set rs3=server.CreateObject("ADODB.Recordset")
set rs3=conntemp.execute(strSQL)
'check to see if catagory has subcategories
strSQL="SELECT idcategory,categoryDesc FROM categories WHERE idParentCategory="& rs3("idcategory")
dim rs4
set rs4=server.CreateObject("ADODB.Recordset")
set rs4=conntemp.execute(strSQL)
if rs4.eof then
subVar3="1"
Else
do while NOT rs4.eof
strSQL="SELECT idcategory,categoryDesc FROM categories WHERE idCategory="& rs4("idCategory")
dim rs5
set rs5=server.CreateObject("ADODB.Recordset")
set rs5=conntemp.execute(strSQL)
'check to see if catagory has subcategories
strSQL="SELECT idcategory,categoryDesc FROM categories WHERE idParentCategory="& rs5("idcategory")
dim rs6
set rs6=server.CreateObject("ADODB.Recordset")
set rs6=conntemp.execute(strSQL)
if rs6.eof then
subVar5="1"
Else
do while NOT rs6.eof
strSQL="SELECT idcategory,categoryDesc FROM categories WHERE idCategory="& rs6("idCategory")
dim rs7
set rs7=server.CreateObject("ADODB.Recordset")
set rs7=conntemp.execute(strSQL)%>
<option value='<%=rs7("idCategory")%>'> <%= rs("categoryDesc") %>
- <%= rs3("categoryDesc") %> - <%= rs5("categoryDesc") %> - <%= rs7("categoryDesc") %></option>
<% rs6.MoveNext
Loop
set rs7=nothing %>
<% End If 'rs6.eof %>
<% If subVar5<>"1" then %>
<% Else %>
<option value='<%=rs5("idCategory")%>'><%= rs("categoryDesc") %>
- <%= rs3("categoryDesc") %> - <%= rs5("categoryDesc") %></option>
<% end if %>
<% rs4.MoveNext
Loop
set rs5=nothing %>
<% End If 'rs4.eof %>
<% If subVar3<>"1" then %>
<% Else %>
<option value='<%=rs3("idCategory")%>'><%= rs("categoryDesc") %>
- <%= rs3("categoryDesc") %></option>
<% end If %>
<% rs2.MoveNext
Loop
set rs3=nothing %>
<% End If 'rs2.eof %>
<% If subVar<>"1" then %>
<% Else %>
<option value='<%=rs("idCategory")%>'><%= rs("categoryDesc") %></option>
<% End If %>
<% subVar="0"
subVar3="0"
subVar5="0"
rs.MoveNext
Loop
set rs1=nothing %>
</select>
<input type="hidden" name="idSupplier" value="10">
</font></td>
</tr>
==============================================
Thanks in advance!!