Hi
for the last few months i've just stuck in 1 error & i don't know how to figer it out
could any body find out where is the problem gonna be ?
it's working fine but when u add product into basket it's bring automatically 1 extra product some time 2 or some time it's working fine i think so problem with GLOBAL.asa File that's not generating proper session variable
GLOBAL.asa -
Sub Application_OnStart
-
-
CStr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & pPath & ";" & "JET OLEDB:Database Password=foo"
-
-
Application("visits") = 0
-
Application("Active") = 0
-
-
set Conn = Server.CreateObject("ADODB.Connection")
-
Conn.Open CStr
-
-
set rsMaxOrder = Conn.Execute("select orderID from" _
-
& " orders " & "order by orderID desc")
-
if rsMaxOrder.EOF then
-
Application("orderID") = 1
-
else
-
Application("orderID") = rsMaxOrder("orderID") + 1
-
end if
-
rsMaxOrder.Close
-
set rsMaxOrder = Nothing
-
Conn.Close
-
set Conn = Nothing
-
End Sub
-
-
Sub Session_OnStart
-
Session("Start") = Now
-
session("uname")=""
-
Application.lock
-
Application("visits") = Application("visits") + 1
-
intTotal_visitors = Application("visits")
-
Application.unlock
-
Session("VisitorID") = intTotal_visitors
-
-
Application.lock
-
Application("Active") = Application("Active") + 1
-
Application.unlock
-
End Sub
-
-
Sub Session_OnEnd
-
Application.lock
-
Application("Active") = Application("Active") - 1
-
Application.unlock
-
-
session("uname")=""
-
If Not Application(Session.SessionID) = "" Then
-
Application(Session.SessionID) = ""
-
End If
-
-
End Sub
-
---------------------------------------------------------
Before i add product into the basket there is no item shown into the basket
But when i add product into the basket & after that review then it's create the problem .
There is 2 files
1 - add_to_cart.asp
2 - review_order.as p
_______________ _______________ _______________ ____________ -
<!-- #include file="database.asp" -->
-
<!-- #include file="adovbs.inc" -->
-
<%
-
-
Sub CreateNewOrder()
-
Application.lock
-
if Application("orderID") = "" then
-
Application("orderID") = 1
-
end if
-
-
intOrderID = Application("orderID")
-
Session("orderID") = intOrderID
-
Conn.Execute("INSERT INTO orders " _
-
& " (orderID, status) values " _
-
& " ("&intOrderID&", 'OPEN')")
-
-
Application("orderID") = Application("orderID") + 1
-
Application.Unlock
-
End Sub
-
-
Sub AddToOrder(nOrderID, nProductID, nQuant)
-
sqlText = "INSERT INTO itemsOrdered " _
-
& " (orderID, productID, quantity) values " _
-
& " ('"&nOrderID&"', '"&nProductID&"', '"&nQuant&"')"
-
Conn.Execute(sqlText)
-
-
End Sub
-
-
'Main program
-
intProdID = Request.form("intProdID")
-
intQuant = Request.form("intQuant")
-
-
set Conn = Server.CreateObject("ADODB.Connection")
-
Conn.Open ConString
-
-
intOrderID = cstr(Session("orderID"))
-
if intOrderID = "" then
-
CreateNewOrder
-
end if
-
-
sqlText = "SELECT * FROM itemsOrdered WHERE orderID =" & intOrderID & "AND productID =" & intProdID
-
set rsOrder = Conn.Execute(sqlText)
-
-
if rsOrder.EOF then
-
txtInfo = "This item has been added to your order."
-
AddToOrder intOrderID, intProdID, intQuant
-
else
-
txtInfo = "This item is already in your cart."
-
end if
-
-
%>
-
<html>
-
<head>
-
</head>
-
<body>
-
<a href="review_Order.asp">review order</a>
-
<%
-
Conn.Close
-
set Conn = Nothing
-
%>
-
-
</font></td></tr></table> </body></html>
_______________ _______________ _______________ ___________
2 - review_order.as p -
<%@ Language=VBScript %>
-
<% pageTitle = "Review Order" %>
-
<!-- #include file="database.asp" -->
-
<!-- #include file="adovbs.inc" -->
-
<html>
-
<head>
-
</head>
-
<body>
-
<%
-
set Conn = Server.CreateObject("ADODB.Connection")
-
Conn.Open ConString
-
-
if cstr(Session("orderID")) = "" then
-
Response.Write "There is no current order." & "<br>"
-
else
-
intOrderID = cstr(Session("orderID"))
-
-
sqlText = "select products.productID, productName, " _
-
& "productPrice, quantity from products, " _
-
& "itemsOrdered where " _
-
& "products.productID = itemsOrdered.productID "_
-
& "and itemsOrdered.orderID = " & intOrderID
-
%>
-
<%
-
set rsReview = Conn.Execute(sqlText)
-
while not rsReview.EOF
-
intProdID = rsReview("productID")
-
strProdName = rsReview("productName")
-
intProdPrice = rsReview("productPrice")
-
intQuant = rsReview("quantity")
-
intTotal = intTotal + (intQuant * intProdPrice)
-
%>
-
-
<input name="quant<%= intProdID %>" value=" <%=intQuant%>"><br>
-
<%= strProdName %> £<%= formatNumber(intProdPrice, 2) %>
-
-
<%
-
rsReview.MoveNext
-
wend
-
-
rsReview.Close
-
set rsReview = Nothing
-
%>
-
<input type="submit" name="control" value="Update Order">
-
<input type="submit" name="control" value="Go To Check-Out">
-
<%
-
end if
-
-
Conn.Close
-
set Conn = Nothing
-
%>
-
</body></html>
Thanks in advance
4 1896
that would be a great if some body repaly on this post thx in advance
jhardman 3,406
Recognized Expert Specialist
I spent a couple hours working on this last night, and I couldn't get your issue to come up. I think the problem might be how you determine the order number when the application starts. Instead of just assigning the number from the application variables, I think you should pull the last number from the db, and add one. Let me know if this helps.
Jared
Hi 1st fo all thank for you kindly reply
i'm attatch my code so you can view where is the problem
following link having the code contains zip file http://www.insidee.net/global.zip
Can you plz take a look following files with having any error
1-global.asa
2-addToCart.asp
3-reviewOrder.asp
the attatch file contains all my file but i think so i forget to put code in global.asa file
Sub Application_OnE nd
' ? ? ? ? ? ?
End Sub
do i have to ?
i'm realy appricate about you concern & you time
if you plz take a look 1 more time about my code i realy gr8 full
if there is any question feel free to send msg
Regards
Fary
jhardman 3,406
Recognized Expert Specialist
I don't think I'll be able to see the problem, I already tried. What I would do to find the problem is to track the orderID. Print it to the page (response.write ) before and after the problem is noticeable, see if you are getting the order Id you expect, and see if anything happens to that number.
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ian N |
last post by:
Hi,
I've been working on a PHP Shopping Basket and have hit a problem.
I wanted update the DB with the contents of the Array which forms the
basket.
This isn't a problem, however i'm unsure how i use Relational Tables
in MySQL.
I have a table called Orders, which stores the CustomersID and also
has an OrderID (this is an autoincrement integer)
|
by: Richard Pain |
last post by:
OK - I have a shopping basket with data in a database. Once the person
has successfully completed their order I want to be able to send them
an email with the products ordered roughly in the following format:
Product Price Quantity
prod1 £6.99 1
prod2 £5.99 2
Postage ...
|
by: TRB_NV |
last post by:
I'd been using an Access database based shopping cart, but wanted to change
it so that it would use session variables. I have a form that's submitted
to a page called addtocart.asp that contains the following information:
intProdID -- ProductID
strProdName -- Product Name
intQuant -- Quantity
intProdPrice -- Price
productType -- Type of product (ie. Wine, Cheese, etc...)
|
by: Rob Meade |
last post by:
Hi all,
I need to implement a simplistic shopping basket/checkout thingy...
I kinda threw something together, but its not keeping more than one item in
the session...
I'm basically loading the page, checking to see if there's an "addToBasket"
value in the querystring, if there is then I grab the product code (also in
the querystring) - now - here's where it seems to be going wrong...
|
by: Rob Meade |
last post by:
Hi all,
Ok - so I've got the array thing going on, and the session thing going on,
and up until now its all been ok.
I've got my view basket page which is displaying 3 rows (as an example) - I
have an input box on each row enabling the user to update the quantity.
If the enter a zero I need to remove the item from the array....
| |
by: Samuel Shulman |
last post by:
Hi
I need to implement a shopping basket for my e-commerce website
Scenarios are as follows
1. Website to offer shopping basket for all visitors including those who
didn't log
2. Website to offer shopping basket ONLY to those that are logged
|
by: Fary4u |
last post by:
Hi
i've design the ASP shopping with MS Access database
it's working fine there is no problem in LOCALHOST
when i upload into the Host Server it's working fine but when u add product into basket it's bring automatically 1 extra product some time 2 or some time 3
i've not made a file called GLOBAL.asa for generate session but if some body add item into the basket it takes OrderID & using Session .
|
by: Shanthini Ganesh |
last post by:
hi all. now i m creating shopping cart. i would like to make when the user click the add to basket button, item added visually shown to user. i found one script for this in net.. but i couldnt pass dynamic productid to that addtobasket javascript function.
this is my function..
function addToBasket(productId)
{
if(!shopping_cart_div)shopping_cart_div = document.getElementById('shopping_cart');
if(!flyingDiv){
flyingDiv =...
|
by: jasone |
last post by:
Hi all and happy new year!
so here's my little problem, im developing a shopping cart for a florist. there will be a traditional shopping cart where the user adds item to basket and so on. i am struggling getting my head round an additional features which will allow the user to create their own bouquet. this will involved a 'flowers_details' tables where the user can select what flowers they want in their basket. when they finish choosing...
|
by: jasone |
last post by:
Hi all and happy new year!
so here's my little problem, im developing a shopping cart for a florist. there will be a traditional shopping cart where the user adds item to basket and so on. i am struggling getting my head round an additional features which will allow the user to create their own bouquet. this will involved a 'flowers_details' tables where the user can select what flowers they want in their basket. when they finish choosing...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |