Sequential numbers - a real challenge

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ken

    Sequential numbers - a real challenge

    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

    #2
    Sequential numbers - a real challenge

    In article <mtSWb.2778$fW. 1448@twister.rd c-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

    Comment

    • Jeff North

      #3
      Re: Sequential numbers - a real challenge

      On Thu, 12 Feb 2004 21:44:50 GMT, in comp.lang.javas cript "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@yourpant sbigpond.net.au : Remove your pants to reply
      ---------------------------------------------------------------

      Comment

      Working...