I am trying to generate a 6 character unique id using this in my model:
 
function generateJobKey()
      {
          // creates a 6 digit key
          $key = substr(md5(uniqid(rand(), true)),0,6);
    //checkto make sure its not a duplcate
          $q = $this->find('first', array('conditions', array('Job.key' =>
$key)));
    if(!$q){
     //if founds re-run the function
     $this->generateJobKey(); 
    
    } else {
   return $key;
    }
 }
 
but I keep getting Maximum execution time of 30 seconds exceeded in so i am
obviously doing somethng wrong. Basically want to verify thekey is not
already created , if so generte anoher ..if not used passthe$key back to the
controller
 
Can someone point out the eror in my setup?
 
Thanks
 
Dave

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to