Click to See Complete Forum and Search --> : database search with asp


demiurgen
04-24-2006, 05:49 AM
if this question seems vague its because i do not yet know much about asp...

i have this page:
http://www.ladac.no/dbLadac/Ladix.asp

but i would like to display everything in a different way.
what do i have to do to display them in different categories or boxes beneath eachother like - chargers - central - relé - etc ??

amongst all these product there is 9 chargers, 2 relés, 7 sentrals etc. and i like to display this in separate boxes.

do i have to make new columns in the database or do i have to change the sql??
i have attached the asp file if you need to look at the code but the mdb file was too big...

please help!!!

gpalat
04-25-2006, 08:37 AM
first of all if you want to have different categories for your products you have to make a table holding all the possible categories that you have. then add a line in the products table category_id, type: int and in every product that you have in your db enter the integer that the specific category has from the category table.

the category table should have: id--> int, name --> char, where id is an automated number incrimented by 1 everytime you add a record in the table and name is the name of the category.

the select for all the products in each category should be:
select * from (TABLE name) where category_id = (id number)

now if you want to know how many products you have in each category the select statement should be sth like this:

SELECT COUNT(id) as newCounter FROM (TABLE name) WHERE category_id = (id number).

then you just have to desplay the newcounter
hope i helped:)