loyd243
02-15-2007, 03:23 AM
Can anybody help me . in my web site i've 12 categories. when i click on the category, corresponding subcategory names are displayed as anchor link. when i click on the each sub category i need to display correponding productimage, product_descriptions,suppliername etc according to the subcategoryID which i pass from the database as querystring. can anybody help. i'm giving you the database design first.
Category_table
--------------
Category_ID Primary Key
CategoryName
Subcategory Table
------------------
subcategory_ID Primary Key
subcategoryName
CategoryID Foriegn Key
Table Products
--------------
ProductID PrimaryKey
ProductName
ProductDescriptions
ProductImage
subcategoryID Foreign Key
------------------------------------
i'm putting my asp code here
-------------------------
Dim category_name,url_value,sub_id,sub_name
Set Ors = Server.CreateObject("Adodb.Recordset")
Ors.Open "SELECT tbl_subcategory.subcategoryName,tbl_postproducts.subcategoryID FROM tbl_subcategory,tbl_postproducts WHERE tbl_postproducts.subcategoryID=tbl_subcategory.subcategoryID",cnnDB
<div class="sub_category_list">
<% DO Until Ors.EOF
sub_id = Ors("subcategoryID")
sub_name = Ors("subcategoryName")
url_value = "?id&value="&sub_id
'Response.Write sub_id
Response.Write("<a href="&url_value&">"&sub_name&"</a>"&"<br><br>")
Ors.MoveNext
Loop
Set Ors = Nothing
------------------------------------------------------------------------
when i click on the above anchor link, i need to display, produtname,productimage, productdescription according to the subcategoryID as querystring from the database.
Please help me
Thanks in advance
Category_table
--------------
Category_ID Primary Key
CategoryName
Subcategory Table
------------------
subcategory_ID Primary Key
subcategoryName
CategoryID Foriegn Key
Table Products
--------------
ProductID PrimaryKey
ProductName
ProductDescriptions
ProductImage
subcategoryID Foreign Key
------------------------------------
i'm putting my asp code here
-------------------------
Dim category_name,url_value,sub_id,sub_name
Set Ors = Server.CreateObject("Adodb.Recordset")
Ors.Open "SELECT tbl_subcategory.subcategoryName,tbl_postproducts.subcategoryID FROM tbl_subcategory,tbl_postproducts WHERE tbl_postproducts.subcategoryID=tbl_subcategory.subcategoryID",cnnDB
<div class="sub_category_list">
<% DO Until Ors.EOF
sub_id = Ors("subcategoryID")
sub_name = Ors("subcategoryName")
url_value = "?id&value="&sub_id
'Response.Write sub_id
Response.Write("<a href="&url_value&">"&sub_name&"</a>"&"<br><br>")
Ors.MoveNext
Loop
Set Ors = Nothing
------------------------------------------------------------------------
when i click on the above anchor link, i need to display, produtname,productimage, productdescription according to the subcategoryID as querystring from the database.
Please help me
Thanks in advance