Hi, I need a script that would allow me to put serials in the MYSQL database and then when I visit the PHP script and user clicks generate it will generate a random serial from the MYSQL Database. Is this possible? Thanks.
Of course it's possible. Buy a book on PHP and SQL or come back with code that doesn't work. If you have some spare cash I'd be willing to create the script for you. I'm a programmer by trade.
You can try this: $i = 0; while ($i < 50) { $random = "abcefghijklmnopqrstuvwxyz123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $randCode = str_shuffle($random)); echo $randCode; }
While str_shuffle() can be used for this purpose, there is a possibility of creating duplicate strings. Extra precautions must therefore be made: <?php $str = "a...Z"; // shorthand notation - fill this in with all allowable chars $codes = array(); $code = null; $numCodes = 10; for($i = 0; $i < $numCodes; $i++) { do { $code = str_shuffle($str); } while(in_array($code, $codes)); $codes[] = $code; } print_r($codes); ?> PHP: