can anyone help?

mazer

New member
Local time
Today, 06:53
Joined
Aug 19, 2005
Messages
8
I'm totally new to asp so any help with this would be greatly appreciated. I have a database table with around 8000 cards, at any one time there is about 5000 cards in stock, which means there is 3000 cards that are not in stock. The problem I have is that when a person search my web site all the cards that are'nt in stock show up in the search with the ones that are in stock, which is quite frustrating for people who don't have broadband.
The search consists of three dropdown boxes that let the user use different criteria to search for the cards that they are looking for. What I thought about doing was using the "WHERE" statement to select item where "Units in Stock" was more than 1
Code:
strQuery = "SELECT DISTINCT Description FROM Cards WHERE UnitsinStock = '>1';"
strQuery = "SELECT DISTINCT Description FROM Cards WHERE UnitsinStock > 1;"
But as you may have gathered this didn't work!
Below is the original code and you can view the search at the following address http://www.themazecomicstore.com/html/magic_the_gathering.asp
Code:
strQuery = "SELECT DISTINCT Description FROM Cards;"
	Set objRS = objConn.Execute(strQuery)
	dropdown(2) = "<SELECT SIZE=1 NAME=colour>"
	While NOT objRS.EOF
		dropdown(2) = dropdown(2) & "<OPTION>" & objRS("Description") & "</OPTION>"
		objRS.MoveNext
	Wend
	dropdown(2) = dropdown(2) & "</SELECT>"

	strQuery = "SELECT DISTINCT ProductType FROM Cards;"
	Set objRS = objConn.Execute(strQuery)
	dropdown(1) = "<SELECT SIZE=1 NAME=producttype>"
	While NOT objRS.EOF
		dropdown(1) = dropdown(1) & "<OPTION>" & objRS("ProductType") & "</OPTION>"
		objRS.MoveNext
	Wend
	dropdown(1) = dropdown(1) & "</SELECT>"

	strQuery = "SELECT DISTINCT ProductGroup FROM Cards;"
	Set objRS = objConn.Execute(strQuery)
	dropdown(0) = "<SELECT SIZE=1 NAME=productset>"
	dropdown(0) = dropdown(0) & "<OPTION></OPTION>"
	While NOT objRS.EOF
		dropdown(0) = dropdown(0) & "<OPTION>" & objRS("ProductGroup") & "</OPTION>"
		objRS.MoveNext
	Wend
	dropdown(0) = dropdown(0) & "</SELECT>"
 

Kodo

"The Shoe"
Local time
Today, 01:53
Joined
Jan 20, 2004
Messages
707
ok, the big problem here is that your database is not normalized. By this I mean that there is repetetive data in your cards table.
I'm assume your table is something like:

cardid (Primary Key)
cardtype (string)
producttype (string)
ProductGroup (string)
description (string)

All of those can be be broken down into their parts using a bridge entity.
Without knowing your business requirements, I mocked up a DB structure that is probably close to what you're looking for. It's my best guess in other words. Take note of the Relationship Diagram.

Remember, this is a rough guess.
 

Attachments

  • cards.zip
    12.1 KB · Views: 230

Users who are viewing this thread

Top Bottom