$connection = mysql_connect("ip","id","pw") or die("데이터베이스 연결실패");
mysql_query('set character set euckr');
mysql_select_db("test",$connection);
$arr1=array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
$arr2=array("1","2","3","4","5","6","7","8","9","0");
$count_i = 0;
for ($t = 0; $t < 500; $t++) {
$str1 = '';
$str2 = '';
for ($i = 0; $i < 3; $i++) {
$j = rand(0, 25);
$str1 .= $arr1[$j];
}
for ($k = 0; $k < 7;$ k++) {
$j = rand(0,9);
$str2 .= $arr2[$j];
}
$str1 = substr(trim($str1), 0, 3);
$str2 = substr(trim($str2), 0, 7);
// echo "str1 : ".$str1."
";
// echo "str2 : ".$str2."
";
if (strlen($str1) == 3 && strlen($str2) == 7) {
$str = $str1.$str2;
}
$tmp = str_shuffle($str);
// echo "tmp3 : ".$tmp3."
";
if (strlen($tmp) == 10) {
$query = "INSERT INTO RAND_TEST SET C_RANDNO = '".$tmp."'";
// echo "query : ".$query."
";
mysql_query($query, $connection);
$count_i++;
}
if($t%10000 == 0) {
flush();
}
}
echo "count : ".$count_i."
";
mysql_close($connection);