generate number

  • buzzby365
  • Proficient
  • Proficient
  • buzzby365
  • Posts: 288

Post 3+ Months Ago

i would like to generate a sequential number.

basically i have a form and on that form is a textfield for a reference number. i would like that number generated. ideally i would like it to be in the format of 'A200' 'A201' and so on, or 'X300', 'X301' and so on. all sequential, nothing random.

i am not sure how to go about this. whether it needs to be a database tihng or text file thing. i spoke with another ozzu member about this but i remain perplexed as to how to go about it. i would like to see how it would work. the form needs to be viewable at any stage once it has been submitted. so maybe something along the lines of a guestbook. even tho it is not a guestbook it has many of the guestbook qualities: read submissions and write submissions and i would like to have them ordered by reference number.

any ideas on how to go about this?
  • panreach
  • Novice
  • Novice
  • User avatar
  • Posts: 28

Post 3+ Months Ago

If you use a database, you can add a field (which is the standard primary key in all tables) that auto increments numerically. Each record you add gets a new number in this field automatically. So you'll probably won't need to use this generated number approach in your forms, because databases do this for you. Primary Key's (w/auto numbers) help you relate to other tables in your database.
  • buzzby365
  • Proficient
  • Proficient
  • buzzby365
  • Posts: 288

Post 3+ Months Ago

ok panreach. based on your theory. is it possible to start the count at a particular number. ie at 200? if this is possible then i will need to make 2 tables/databases. one for 'X' numbers and one for 'A' numbers. reason for this is because you can have an 'A' number which is 'A233' and an 'X' number whch also can be 'X233'. same number, different prefix therefore different meaning. for this to happen i would need 2 different databases or can an if statement solve this particular problem?

can the count be designed to start at a certain number (for both 'A' and 'X' prefixes) i would also like them to begin at a certain number. is that possibe?

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 33 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.