Jump to content

Random Pilot ID Generation


Talisman57

Recommended Posts

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.

:)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...