By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,538 Members | 875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,538 IT Pros & Developers. It's quick & easy.

Sequential numbers - a real challenge

P: n/a
Ken
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

Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <mt****************@twister.rdc-kc.rr.com>,
"Ken" <kk******@wi.rr.com> wrote:
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


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
Jul 20 '05 #2

P: n/a
On Thu, 12 Feb 2004 21:44:50 GMT, in comp.lang.javascript "Ken"
<kk******@wi.rr.com> wrote:
| 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.


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.
---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.