Jump to content

Recommended Posts

Posted

Hello,

I'm trying to make it so that random ID's are assigned to pilots, and not in sequential order. Is there a possibility to this? I've done it for other CMS's but I don't know if the MySQL wont like the randomness.

Thanks for your help

Dave

Posted

Providing they're unique you should be ok to insert them rather than using mysqls automatic generation. I don't have time to go check what you need to do right now but you'll need to edit the function that processes registration.

You'll want to retrieve all existing pilot codes from the database and add a while loop to generate a new one and check it doesn't already exist. Then you'll also need to change the sql insert to define a pilot code.

:)

Posted

Excluding the phpVMS parts you could do something like this:

// get all pilotcodes into array (probably need your own function for this)
$rand = rand(100,999);
while(in_array($rand, $allpilotcodes)){
   $rand = rand(100,999);
}
// Put $rand in as your new pilotcode

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...