VAL said the following on 12/10/2005 20:13:[color=blue]
> How can I make an application form that generates a unique number starting
> from 1001.?
>[/color]
Did you even bother to read the PHP manual for random functions, e.g.
rand()?
I noticed that Message-ID: <4Ee3f.11072$6c 4.10809@newsfe5-win.ntli.net>
from Oli Filth contained the following:
[color=blue][color=green]
>> How can I make an application form that generates a unique number starting
>> from 1001.?
>>[/color]
>
>Did you even bother to read the PHP manual for random functions, e.g.
>rand()?[/color]
Why bother with rand()? Just start at 1001 and increment. Each number
will be unique.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Nicholas Sherlock wrote:[color=blue]
> VAL wrote:
>[color=green]
>> How can I make an application form that generates a unique number
>> starting from 1001.?[/color]
>
>
> Your subject line says "Random number", and you are asking for a "Unique
> number". Which is it? A random number, or a number which is unique, or
> both?
>
> Cheers,
> Nicholas Sherlock[/color]
I interpreted this (despite the subject, which I didn't notice) as 'how
can I arrange that every time this page is run it will generate a
different number?'
If that is indeed the question, then you need to save the latest number
(or all of them, if they are indeed to be random rather than sequential)
locally on the server - either in a file or in a database.
Your question is contradictory mate you couldnt make a random number
that began with specified non random value. You could however make a
string variable that was comprised of both a constant value of '1001.'
and an entirely random number using a random number generating
function. Like this
$string .= '1001';
$string .= 'your random number';
echo $string;
You would need to ask someone else about generating a random number in
PHP as i've never had to do it, i just stick a few incrementing numbers
together pulled from a database if i want to create a unique value like
for a transaction ID or something.
Comment