We need a piece of PHP code to generate random 3-digit numbers as part of the order numbers in our CRE Loaded site.
This should be an easy job. We need somebody code it quickly.
1. The generated random number has to be 3-digit (000-999)
2. There can not be duplicate numbers in the same day period
3. We will create the SQL table on your request
For your reference. Here is the flowchart showing our idea. You don't have to exactly follow it if you have a better idea.
Check the date of the
numbers in table
| n clear table and
Same day? ------> reset the date
| y |
$abc = rand (0, 999) <---|
Duplicate number y |
found in table? ------>
$abc < 100 ? ---------
| y |
Add prefix 0 or 00 |
to make $abc 3-digit |
The flowchart is messed up. Attached please find the PDF version.