我与我的亚洲开发银行和用户联系,提交电子邮件地址。 储存在亚洲开发银行。 这是我从动荡中挑选出来的。
I d like a user-unique code generated through JS on document load.. Format should be 6 digits in length and only using only A-Z and 0-9. ie: F4DRB6
Once that is done I d need to store that unique code for that user in the DB.
The generator should check if the unique code exists in the DB, to ensure it is actually unique.
我的麻烦在于:我不知道如何以上述格式制定独特的守则,检查它是否有别于非行,然后将其存放在与该用户相称的非行。 下面是一栏,与浏览量相对应?
感谢!
www.un.org/Depts/DGACM/index_spanish.htm EDIT:我试图这样做,如果有任何错误,请注明。 附录
function genRandomString() {
$length = 5;
$characters = 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ ;
$string = ;
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}
do {
$random_string = $this->genRandomString();
} while (mysql_num_rows(mysql_query("SELECT referralcode FROM ".coming_soon_emails." WHERE rand_string= {$random_string} ")));
$q = "INSERT INTO ".coming_soon_emails." SET referralcode= {$random_string} ";
$result = mysql_query($q);