Okay, So I would like to do the following. The user enters their email into a html forum...the code then checks the database for the email, if the email is in the database on the next page it echos out what is on row "key". If the email is not in the database it adds it to a random row where "used" isnt equal to 1...it also logs the ip. But it also preforms an ip check as well as an email check..so if there is an ip matched it echos out row "key" and error message, you already have a key.

SQL format
Email IP Key Used

not too sure how to approach this