Storing re-usable data - shopping cart

S

Sean

HI,

I have a shopping cart in which I am trying to use breadcrumb style
navgiation. I need to be able to display the categroy heading relating to
the section of the site a visitor is using i.e If a user is in the "camera"
section I need to display that heading as a link "camera", however in order
to do this at the moment I am querying the database and storing the
recordset in the application object (see below). I should imaging there is a
much better way of doing this, if there is can someone help me out with some
code?

Sean



SQL = "SELECT Catid,catDesc,ParentCatid FROM product_categories WHERE
Catid=" &pCatId
set rs = db_conn.execute(SQL)

Application("CategoryName") = rs(1).Value
 
M

Mosley

Sean said:
HI,

I have a shopping cart in which I am trying to use breadcrumb style
navgiation. I need to be able to display the categroy heading relating to
the section of the site a visitor is using i.e If a user is in the "camera"
section I need to display that heading as a link "camera", however in order
to do this at the moment I am querying the database and storing the
recordset in the application object (see below). I should imaging there is a
much better way of doing this, if there is can someone help me out with some
code?

Sean



SQL = "SELECT Catid,catDesc,ParentCatid FROM product_categories WHERE
Catid=" &pCatId
set rs = db_conn.execute(SQL)

Application("CategoryName") = rs(1).Value

Im not sure what your aim is,

but

A Application("CategoryName") variable is the same for all users, so if one
user changes the variable from 'camera' to 'film', the value will change for
all users no mater if they are in the camera or film or what ever section.
this value stays till changed or site is restated.
For example, if you were running a action, you would want the latest bid to
be seen bid to be seen by all users
to avoid the chance that 2 users may use the variable at the same time, use
Application.Lock and Application.Unlock when you change a Application
variable



A Session("CategoryName") variable is for the user only, and lasts as long
as the session, if you close the browser you lose the values. You can leave
the page as long as you come back before the session times out default is 20
minutes

a normal DIM CategoryName variable loses its value as to leave the page.
 
M

MN

Sean said:
HI,

I have a shopping cart in which I am trying to use breadcrumb style
navgiation. I need to be able to display the categroy heading relating to
the section of the site a visitor is using i.e If a user is in the "camera"
section I need to display that heading as a link "camera", however in order
to do this at the moment I am querying the database and storing the
recordset in the application object (see below). I should imaging there is a
much better way of doing this, if there is can someone help me out with some
code?

Sean



SQL = "SELECT Catid,catDesc,ParentCatid FROM product_categories WHERE
Catid=" &pCatId
set rs = db_conn.execute(SQL)

Application("CategoryName") = rs(1).Value

As another poster has suggested, use the session object to maintain
state throughout the user's visit. I would suggest replacing your
in-line SQL with a call to a stored procedure, as it stands your code
could be open to a SQL injection attack.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top