Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. function AlphaNumeric($length)
  2. {
  3. $chars = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_";
  4. $clen = strlen( $chars )-1;
  5. $id = '';
  6.  
  7. for ($i = 0; $i < $length; $i++) {
  8. $id .= $chars[mt_rand(0,$clen)];
  9. }
  10. return ($id);
  11. }
  12.  
  13. for($i=0; $i<10; $i++)
  14. {
  15. $cod = AlphaNumeric(10);
  16.  
  17. $sql1[$i] = "INSERT INTO wm_voucere (id, cod) VALUES (NULL, '$cod')";
  18. $result1[$i] = mysqli_query($connection, $sql1[$i]);
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement