Connecting Tech Pros Worldwide Forums | Help | Site Map

Sequential numbers - a real challenge

Ken
Guest
 
Posts: n/a
#1: Jul 20 '05
This is a challenge. Perhaps someone can offer suggestions.

I am trying to create a variable, ordernumber, that increases by an
increment of 1 every time the variable is accessed.

For example:
Call up the variable the first time: ordernumber = 1

"Reopen" the webpage, call up the variable a second time: ordernumber = 2,
etc.

I am trying to create sequential order numbers without using the date or the
alphabet. I would like the order number to be a max of 6 numeric digits.

The problem I am having is finding a way for the ordernumber to be
remembered on the server, so when I call it up the next time, it can be
incremented by 1.

Thanks for the thoughts.

Ken




Robert
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Sequential numbers - a real challenge


In article <mtSWb.2778$fW.1448@twister.rdc-kc.rr.com>,
"Ken" <kkrolski@wi.rr.com> wrote:
[color=blue]
> This is a challenge. Perhaps someone can offer suggestions.
>
> I am trying to create a variable, ordernumber, that increases by an
> increment of 1 every time the variable is accessed.
>
> For example:
> Call up the variable the first time: ordernumber = 1
>
> "Reopen" the webpage, call up the variable a second time: ordernumber = 2,
> etc.
>
> I am trying to create sequential order numbers without using the date or the
> alphabet. I would like the order number to be a max of 6 numeric digits.
>
> The problem I am having is finding a way for the ordernumber to be
> remembered on the server, so when I call it up the next time, it can be
> incremented by 1.
>
> Thanks for the thoughts.
>
> Ken
>
>
>[/color]

You will need to do this in a server script.

On the client, you could create a cookie with a number in it but be
aware that the user can delete or disable cookies.

Robert
Jeff North
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Sequential numbers - a real challenge


On Thu, 12 Feb 2004 21:44:50 GMT, in comp.lang.javascript "Ken"
<kkrolski@wi.rr.com> wrote:
[color=blue]
>| This is a challenge. Perhaps someone can offer suggestions.
>|
>| I am trying to create a variable, ordernumber, that increases by an
>| increment of 1 every time the variable is accessed.
>|
>| For example:
>| Call up the variable the first time: ordernumber = 1
>|
>| "Reopen" the webpage, call up the variable a second time: ordernumber = 2,
>| etc.
>|
>| I am trying to create sequential order numbers without using the date or the
>| alphabet. I would like the order number to be a max of 6 numeric digits.
>|
>| The problem I am having is finding a way for the ordernumber to be
>| remembered on the server, so when I call it up the next time, it can be
>| incremented by 1.
>|
>| Thanks for the thoughts.[/color]

You shouldn't rely on the web page to hold such information.
Reason 1: if I click on the back/forward buttons on the browser this
will alter the number on not reflect the 'true' value to store.

Reason 2: if 20 people access the page at the same time then they will
all be given the same number. When then store their information then
they might end up with the same order number.

Let your database handle this auto-incrementing number.
---------------------------------------------------------------
jnorth@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Closed Thread


Similar JavaScript / Ajax / DHTML bytes