I want to generate a unique hash/number that I can use for status tracking for an contest. I'm going to use this hash/number in a url created with add_query_args.
The url creation will look something like this:
$url = add_query_arg( array( 'id' => 'tracking_number_comes_here', 'email' => '$contest_object->email' ), $redirect_url );
That will output something like this:
This is working fine, but I'm having a hard way to generate a unique hash/number to use as the tracking number.
A row is added to contest table when a participant submits his participation. I use wpdb to insert to my table:
// Add user to db $addRow = $wpdb->insert( $wpdb->contest, array( 'name' => $data['name'], 'email' => $data['email'], 'shared_facebook' => 0, 'shared_mail' => 0, 'tracking' => $unique_hash_number ) );
I think generating an 8 character hash from an integer with md5 were the integer is the participant ID will work.
$hash = substr(md5($id), 0, 8);
Is it possible to grab the participant id on insertion? or do I have to update the hash after the participant is added to the table?