Welcome Guest, Not a member yet? Register   Sign In
Generating Unique ID
#8

[eluser]Randy Casburn[/eluser]
I know Mike, you being the hero and all, this is sooo much easier:

Code:
function make_unique($filename = NULL) {
  if ($filename !== NULL) {
    $this->load->helper('string');
    $unique = FALSE;
    while ($unique === FALSE) {
      if ($this->db->update('files', array('id' => random_string('alnum', 5)), array('filename' => $filename))) {
        $unique = TRUE;
      }
    }
    return TRUE;
  }
  return FALSE;
}

than this:

Code:
substr(...);

I bow to your prowess...


Messages In This Thread
Generating Unique ID - by El Forum - 07-06-2008, 11:14 AM
Generating Unique ID - by El Forum - 07-06-2008, 11:23 AM
Generating Unique ID - by El Forum - 07-06-2008, 12:59 PM
Generating Unique ID - by El Forum - 07-06-2008, 04:11 PM
Generating Unique ID - by El Forum - 07-06-2008, 04:19 PM
Generating Unique ID - by El Forum - 07-06-2008, 04:30 PM
Generating Unique ID - by El Forum - 07-06-2008, 06:07 PM
Generating Unique ID - by El Forum - 07-06-2008, 06:23 PM
Generating Unique ID - by El Forum - 07-06-2008, 07:32 PM
Generating Unique ID - by El Forum - 07-06-2008, 08:41 PM
Generating Unique ID - by El Forum - 07-06-2008, 10:18 PM
Generating Unique ID - by El Forum - 07-06-2008, 10:35 PM
Generating Unique ID - by El Forum - 07-06-2008, 11:48 PM
Generating Unique ID - by El Forum - 07-07-2008, 12:27 AM
Generating Unique ID - by El Forum - 07-07-2008, 12:53 AM
Generating Unique ID - by El Forum - 07-07-2008, 01:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB