List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:July 15 1999 11:42pm
Subject:Re: Unique ID Generation
View as plain text  
PinkeshP@stripped wrote:

> can anyone give me idea on generating unique id in the record?
> i was thinking of
> *rand()*10
> is it safe enough to generate unique id like this?

for our test proceedure database, I used this with some PHP:

    $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',
       null, '$description', null, '$resolution')";

the Daevid.

Unique ID GenerationPinkeshP15 Jul
  • Re: Unique ID GenerationPaul DuBois15 Jul
  • RE: Unique ID GenerationDon Read15 Jul
    • RE: Unique ID GenerationDon Read15 Jul
      • Re: Unique ID GenerationDaevid Vincent16 Jul
    • RE: Unique ID GenerationLincoln Yeoh16 Jul
  • Re: Unique ID GenerationDaevid Vincent16 Jul
  • Re: Unique ID GenerationDaevid Vincent16 Jul
Re: Unique ID GenerationKevin Smith15 Jul