I need to generate an alpha numeric string and compare with database values but if the value is present in database then we should generate a different numeric string and again it should be compared with database values....
<?php
$character_array = array_merge(range('a', 'z'), range(0, 9));
$Emp_Id = "";
for($i = 0; $i < 6; $i++) {
$Emp_Id .= $character_array[rand(0, (count($character_array) - 1))];} ?>
which is working fine by creating an alpha numeric code,But as i have mentioned above i need to compare it with database values.
$chkEmp_Id=mysql_fetch_array(mysql_query("SELECT Emp_Id FROM talent_users WHERE Emp_Id='{$Emp_Id}' "));
after comparing with database values if the value is present then it should generate a different "Emp_Id",every time generated employee id should be compared with database values...hope u guys got it na?please help me to fix this...