Jump to content

Arizona

Members
  • Posts

    2
  • Joined

  • Last visited

Arizona's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hi pulpfiction,Thanks for the quick reply.Here is some of the code...For the main product page...<%Dim mySQL, myRSSet myRS = Server.CreateObject("ADODB.Recordset")mySQL = "SELECT CategoryID, Pic, Category, BriefDesc FROM Categories"myRS.Open mySQL, myConnDo While Not myRS.EOF Response.Write RecToTable(myRS)myRS.MoveNextLoopResponse.Write "</p>"myRS.CloseSet myRS = Nothing%> When you click on a product from that page, this is the code to make it display categories with no sub catergories... wasn't sure about the If Then statements... <%Dim mySQL, myRS, CategoryIDCategoryID = 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 IfIf CategoryID = "7" Then Response.Redirect("Garden.asp")End IfIf CategoryID = "12" Then Response.Redirect("Kitchen.asp")End IfIf CategoryID = "19" Then Response.Redirect("Lighting.asp")End IfIf CategoryID = "22" Then Response.Redirect("Telephones.asp")End IfSet myRS = Server.CreateObject("ADODB.Recordset")myRS.Open mySQL, myConnDo While Not myRS.EOF Response.Write RecToTable(myRS) myRS.MoveNextLoopResponse.Write "</p>" myRS.CloseSet 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... <%Dim mySQL, myRSSet myRS = Server.CreateObject("ADODB.Recordset")mySQL = "SELECT Category2ID, Pic2, Category2 FROM Categories2 WHERE CatergoryID = "& CategoryID &""myRS.Open mySQL, myConnDo While Not myRS.EOF Response.Write RecToTable(myRS)myRS.MoveNextLoopResponse.Write "</p>"myRS.CloseSet myRS = Nothing%> This is the one with the problem cos it will display every sub category and not just the two clock categories.The 3 database tables are like this:Main Category Table:Sub Category Table:Products Table:Sorry to post all this but I'm completely baffled by how to make the code stop displaying after the subcategory needed. I know it shouldn't be a Dow While EOF thing but I can't figure what it should be cos it's got to the point where I've looked at it so long I can't see anything anymore.Hope you can help!
  2. Hi,I'm new to all this and really need help on something that I've been banging my head against for a while.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? I'm sure this is so straight forward and simple but I just can't seem to figure out how it's done.Thanks in advance.
×
×
  • Create New...