Tutorial is here: Creating a Stylish Coming Soon Page with jQuery | Tutorialzine

Where it does this:

PHP Code:
    15            $mysqli->query("INSERT INTO coming_soon_emails
    16                            SET email='"
.$mysqli->real_escape_string($_POST['email'])."'");
    
17     
    18            
if($mysqli->affected_rows != 1){
    
19                throw new Exception('This email already exists in the database.');
    
20            
Once it checks the email is not a duplicate, I would like it to add a unique (no two email records should have the same) Alphanumeric code like this: AQ4ILB9

Then when the user gets the "Thank you!" message in the textbox, I want it to also display the unique code as above.

I have to setup a new column in the DB for the addition of a code, correct? What properties must it have when adding to do the above code insertion? Possibly automatically creating the unique code for each record so the DB does the random code insertion work rather than a loop check in php?

How can I display the code to the user once the "Thank you!" message is displayed.

Any help editing the tutorial would be much appreciated!

Thanks!