php random vs sequential numbers
Moderator: General Moderators
-
skydivelouie
- Forum Newbie
- Posts: 23
- Joined: Tue Jan 18, 2005 7:07 pm
php random vs sequential numbers
If anyone can help that would be great.
I am using MMEX to post form info. It allows me to generate a submision ID randomly.
I am wanting the numbers to be sequential.
I have found TONS of info on generating random numbers but none on sequential.
$a=rand(100,1000); - Would creat a random number between 100 and 1000.
$a=rand(100,1000);$a++; - Only seems to increase the number by one, and does not continue to increase. It just repeats the same single increment.
How can I get the number to start at 100 and increase by 1 each time the form is submitted. Any help on this would be greatly appreciated.
Please help! I need someone smarter than me, and that's everyone.
I am using MMEX to post form info. It allows me to generate a submision ID randomly.
I am wanting the numbers to be sequential.
I have found TONS of info on generating random numbers but none on sequential.
$a=rand(100,1000); - Would creat a random number between 100 and 1000.
$a=rand(100,1000);$a++; - Only seems to increase the number by one, and does not continue to increase. It just repeats the same single increment.
How can I get the number to start at 100 and increase by 1 each time the form is submitted. Any help on this would be greatly appreciated.
Please help! I need someone smarter than me, and that's everyone.
-
skydivelouie
- Forum Newbie
- Posts: 23
- Joined: Tue Jan 18, 2005 7:07 pm
-
skydivelouie
- Forum Newbie
- Posts: 23
- Joined: Tue Jan 18, 2005 7:07 pm
-
skydivelouie
- Forum Newbie
- Posts: 23
- Joined: Tue Jan 18, 2005 7:07 pm
-
skydivelouie
- Forum Newbie
- Posts: 23
- Joined: Tue Jan 18, 2005 7:07 pm
-
skydivelouie
- Forum Newbie
- Posts: 23
- Joined: Tue Jan 18, 2005 7:07 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
then you need access to a database.
The only other option is creating a file on the server, it can store the number used, along with their information. This is usually called a flatfile, or flatfile database. I would highly suggest using a real database though, as flatfiles can have lots of problems with concurrent sessions.
The only other option is creating a file on the server, it can store the number used, along with their information. This is usually called a flatfile, or flatfile database. I would highly suggest using a real database though, as flatfiles can have lots of problems with concurrent sessions.
-
skydivelouie
- Forum Newbie
- Posts: 23
- Joined: Tue Jan 18, 2005 7:07 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
you'll need a table created where you have at least an id that is set to auto_increment. When a new record is created, that number will always be unique (outside of a few circumstances)
I would suggest creating this table with a field/column for each piece of information you want to keep on these customer orders.
A basic MySQL tutorial would probably be a good idea to walk through. There are many around the net. Once you have this stuff figured out, you can move into making insertion calls with php, then create a form to tell the script what to insert. These things should be covered in many of the tutorials.
I would suggest creating this table with a field/column for each piece of information you want to keep on these customer orders.
A basic MySQL tutorial would probably be a good idea to walk through. There are many around the net. Once you have this stuff figured out, you can move into making insertion calls with php, then create a form to tell the script what to insert. These things should be covered in many of the tutorials.
-
skydivelouie
- Forum Newbie
- Posts: 23
- Joined: Tue Jan 18, 2005 7:07 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
well. although I haven't read it, we do have a 2 parter here:
viewtopic.php?t=24396
You can find part 2 in the tutorials section.
viewtopic.php?t=24396
You can find part 2 in the tutorials section.