I know there is a simple answer to this but I seriously need help.
Basically I have a shopping site which has categories of different items. Fine, I can get the code to display a picture of each category and open up the category from each seperate picture, my problem is the sub categories.
For example, The category for clocks has sub categories for wall clocks and alarm clocks. Although the code opens up the sub categories when you click on the main clock picture, it also opens up ALL sub categories.
How do I get it to stop and only open the too clock subcats?
Here is the code:
Main category page, When you click on a product from the main page, this is the code to make it display categories with no sub catergories... wasn't sure about the If Then statements...
Code:
<%
Dim mySQL, myRS, CategoryID
CategoryID = CInt(Request.QueryString("CategoryID"))
mySQL = "SELECT ProductID, Image, Title, Price, Description " &_
"FROM Categories INNER JOIN Products " &_
"ON Categories.CategoryID = Products.CategoryID " &_
"WHERE Products.CategoryID = " & CategoryID & " " &_
"ORDER BY ProductID"
If CategoryID = "4" Then
Response.Redirect("Clocks.asp")
End If
If CategoryID = "7" Then
Response.Redirect("Garden.asp")
End If
If CategoryID = "12" Then
Response.Redirect("Kitchen.asp")
End If
If CategoryID = "19" Then
Response.Redirect("Lighting.asp")
End If
If CategoryID = "22" Then
Response.Redirect("Telephones.asp")
End If
Set myRS = Server.CreateObject("ADODB.Recordset")
myRS.Open mySQL, myConn
Do While Not myRS.EOF
Response.Write RecToTable(myRS)
myRS.MoveNext
Loop
Response.Write "</p>"
myRS.Close
Set myRS = Nothing
%>
Then, so far I have been working on Clocks, so if a user clicks on the clock link they are redirected to clocks.asp which contains this code...
Code:
<%
Dim mySQL, myRS
Set myRS = Server.CreateObject("ADODB.Recordset")
mySQL = "SELECT Category2ID, Pic2, Category2 FROM Categories2 WHERE CatergoryID = "& CategoryID &""
myRS.Open mySQL, myConn
Do While Not myRS.EOF
Response.Write RecToTable(myRS)
myRS.MoveNext
Loop
Response.Write "</p>"
myRS.Close
Set myRS = Nothing
%>
what am I doing wrong?
Please help. It's driving me nuts!