I have a sign up form that generates a activation key and emails it to user and they cannot login until account has been activated etc.
I know how to do the MySQL query to check if activation key already exists and have a function that generates a random key but not sure how to basically tell PHP that if the activation key already exists in DB then generate a new key until one is found that does not already exist.
I gather i may need a loop but not sure. Could someone please help ?
Like i say i know how to do the MySQL query and have created a function that generates a random key just need some sample code to know how to do what i asked above.
Thanks for any help; Much Appreciated