may be something like
$sql="DELETE FROM Table_Users WHERE EraseKey = '$key';";
I would do it this way:
when user registers, a activationkey and a deactivationkey
is generated and stored in the database.
A Flag-Field like "is_active" is stored with '0'
User gets a mail with both keys:
click this link, to activate your account:
http://your.site.com/thescript.php?action=activate&key=00a0sdd3dfdt235s
click here to erase your account (or in case, you never registred to my site...)
http://....../thescript.php?action=erase&key=2345sk3234k334
On your site should be a link "erase my account".
User clicks... a email is sent to the email stored in the database:
If you really want to erase your account, click here:
http://....../thescript.php?action=erase&key=2345sk3234k334
Only if the user activates his account, he gets newsletter and so on...
just a idea 🙂