Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- $rand = 1000;
- for($i=1;$i<=$count[0]['count'];$i++)
- {
- do
- {
- // generate id
- $record['cart_order_id'] = date("ymd-His-").$rand;
- }
- // check 1. id is not in db 2. id is not already generated
- while ( array_search($record,$existing_id) !== FALSE ||
- array_search($record['cart_order_id'],$used) !== FALSE );
- // store id
- $used[] = $record['cart_order_id'];
- // increment counter
- $rand = ($rand < 9999) ? $rand+1 : '1000';
- }
- // output results
- echo "id\r\n".implode("\r\n",$used);
- ?>
Add Comment
Please, Sign In to add comment