Jump to content

Random Number


princeofpersia

Recommended Posts

Hi Guys

 

I have a code what inserts very simple queries to database, im trying to add a random reference number for each enrty using

$reference = rand(111111111111,999999999999);

 

but each time I add an entry it gives me the same random number previously generated for previous entry

 

can you help pleasE?

Link to comment
https://forums.phpfreaks.com/topic/219905-random-number/
Share on other sites

yeah, i have solved it, I have changed the number

from

$reference = rand(111111111111,999999999999);

 

to

 

$reference = rand(11111111,99999999);

 

so less digits and it work fine, im not using loop but I have tried it few times and now it gives me different reference numbers each I add an entry,

 

thanks for you time guys

Link to comment
https://forums.phpfreaks.com/topic/219905-random-number/#findComment-1139946
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.