The goal: Have 100 users into a table with each having a number assigned to them, chosen at random from a pre-setup table full of numbers. Each number is different and shouldn't be used for more than 1 user. Once 100 users have been added, no more inserts can be made and an alert will appear in the 101st insert.

I have two tables setup in MySQL.
The table 'users' (which is empty) and another table 'number' (100 rows with values to assign to new users), how could I use PHP to go:

On form submit, insert a new user (name as the input) into 'users', get a random value from 'number' and assign it to the user, mark that value from 'number' as "used up so no other name can get that value", and once the 100 users have been added (ie: the 100 values from 'number' have been assigned), the 101st insert will say "Sorry, database is full".

It's quite confusing for me to understand how to do this in PHP..

Thanks in advance.