PinkeshP@stripped wrote:
> can anyone give me idea on generating unique id in the record?
> i was thinking of
> MINUTE(NOW())*SECOND(NOW())*HOUR(NOW())*DAYOFMONTH(CURDATE())*MONTH(CURDATE())
> *rand()*10
>
> is it safe enough to generate unique id like this?
for our test proceedure database, I used this with some PHP:
srand((double)microtime()*1000000);
$checkid = 1;
while ($checkid > 0) { // this means it exists already
$test_id = rand(1000000000,9999999999);
$checkid = mysql_numrows(mysql_db_query("wt_client", "SELECT test_id FROM
Test_Table WHERE test_id = $test_id"));
//echo "random test_id = ".$test_id." checkid = ".$checkid."<BR>\n";
}
$sql = "INSERT INTO Test_Table VALUES ($test_id,'$guid',
'$player_version','$os','$os_version','$cpu','$mhz','$ram',
null, '$description', null, '$resolution')";