473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

categories

Im setting up a database driving store running off of a sql database
and asp.
I want to have categories with subcategories. That way a customer can
borrow down through my site to buy a product.
For example: going to a grocery store your looking for cake.
categories would be Groceries -> Bakery -> Cake -> Chocolate -> Happy
Birthday or
Groceries -> bakery -> Cake -> White -> Congratulations

How should i setup the database and with asp how would i list the
categories so that whenever the customer comes to my site it would say
Bakery Snacks
Cake Chips
Donuts Pretzels
Rolls Oreos
Dairy
Milk
Cheese
Yogurt
Jul 19 '05 #1
2 1589
"jeef" <je*******@hotmail.com> wrote in message
news:9f**************************@posting.google.c om...
Im setting up a database driving store running off of a sql database
and asp.
I want to have categories with subcategories. That way a customer can
borrow down through my site to buy a product.
For example: going to a grocery store your looking for cake.
categories would be Groceries -> Bakery -> Cake -> Chocolate -> Happy
Birthday or
Groceries -> bakery -> Cake -> White -> Congratulations

How should i setup the database and with asp how would i list the
categories so that whenever the customer comes to my site it would say
Bakery Snacks
Cake Chips
Donuts Pretzels
Rolls Oreos
Dairy
Milk
Cheese
Yogurt


What database/version? If it's MS SQL Server, there's an article in
Books Online (BOL) under the heading "Expanding Hierarchies" that does
what you're looking for.

HTH
-Chris Hohmann
Jul 19 '05 #2
hi,
you can use this ...

tbl_categories
=======================================
id(autonumber),name(text 255),up_cat_id(Number - which is the ID of up
Category)
=======================================
<%
cat=request("cat") ' current category
strsql="Select * From tbl_categories where up_cat_id=" & cat & " order by
id"
objrs.open strsql, objconn,3,1
count=objrs.recordcount\2+1
if count=objrs.recordcount/2+1 then count=count-1
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse; font-size:8pt" bordercolor="#111111" width="100%"
id="AutoNumber1">
<tr>
<td width="50%" valign="top">
<%
for i=1 to count
if not objrs.eof then
strsql1="Select * From tbl_categories where up_cat_id=" & objrs("id") & "
order by id"
objrs1.open strsql1, objconn,3,1
%>
<p><a href="./?cat=<%=objrs("id")%>" style="text-decoration:
none"><b><%=objrs("name")%></b></a><br>
<%
do while not objrs1.eof
%>
-<a href="./?cat=<%=objrs1("id")%>" style="text-decoration: none">
<%=objrs1("name")%></a><br>
<%
objrs1.movenext
loop
objrs1.close
objrs.movenext
end if
next
%>
</td><td width="50%" valign="top">
<%
for i=1 to count
if not objrs.eof then
strsql1="Select * From tbl_categories where up_cat_id=" & objrs("id") & "
order by id"
objrs1.open strsql1, objconn,3,1
%>
<p><a href="./?cat=<%=objrs("id")%>" style="text-decoration:
none"><b><%=objrs("name")%></b></a><br>
<%
do while not objrs1.eof
%>
-<a href="./?cat=<%=objrs1("id")%>" style="text-decoration: none">
<%=objrs1("name")%></a><br>
<%
objrs1.movenext
loop
objrs1.close
objrs.movenext
end if
next
%>
</td> </tr>

</table>

===============================================
Nav!d
Free Weblog Management System @
http://www.asp-rider.com/
(But in Persian)
===============================================

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl...
"jeef" <je*******@hotmail.com> wrote in message
news:9f**************************@posting.google.c om...
Im setting up a database driving store running off of a sql database
and asp.
I want to have categories with subcategories. That way a customer can
borrow down through my site to buy a product.
For example: going to a grocery store your looking for cake.
categories would be Groceries -> Bakery -> Cake -> Chocolate -> Happy
Birthday or
Groceries -> bakery -> Cake -> White -> Congratulations

How should i setup the database and with asp how would i list the
categories so that whenever the customer comes to my site it would say
Bakery Snacks
Cake Chips
Donuts Pretzels
Rolls Oreos
Dairy
Milk
Cheese
Yogurt


What database/version? If it's MS SQL Server, there's an article in
Books Online (BOL) under the heading "Expanding Hierarchies" that does
what you're looking for.

HTH
-Chris Hohmann

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Brian | last post by:
Greetings, I'm working on a project that involved that has need of a categorization system. Logically speaking, the system will have elements, these elements will belong to at least a single...
2
by: Troy Lynch | last post by:
I'm working on writing a website which I need to have lists of products listed in categories and subcategories, and need to keep track of whats in the tree. Like how many products from the root all...
3
by: Jeremy Ross | last post by:
Hello, I am looking for a tutorial, or some help with a slight problem that I am having. What I need to do is create a bit of code that will allow me to select multiple categories for a...
0
by: Ralph Guzman | last post by:
TASK: I have to generate a report with all categories, subcategories and products in database. PROBLEM: I want to write one query that will return: 1. category 2. subcategory: determined by...
1
by: Neil McGuigan | last post by:
Hi, I want to store product categories in my db and am a little lost as to where to start. They can be hierarchical, such as "Books" > "Cook Books", so my table is like this: int...
1
by: savvy | last post by:
I'm using MS SQL 2000. I developing a shopping cart where on the admin side when we are inserting or updating the products, there is a chance that a single product can fall into two categories...
13
by: hornedw | last post by:
I have been working on a ecommerce website for myself. What I needed some assistance on was when i was trying to display the categories/subcategories for the different products. I decided to use...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
2
by: tagnum | last post by:
I have written a program for unlimited categories depth, which is in use for few ecommerce websites. Like many others, I used one SQL table to store the category relation (or the tree structure)....
1
realayumi
by: realayumi | last post by:
ACCESS 2003 WIN XP Hi, i'm new in access, just a view days, this is my first post. Sorry for my bad English. I have 3 tables. tbl_product
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.