I have 1 table with all of my user information. All information is the form of $user.name, $user.date, etc, ($user = username)
I want the user to be able to delete their account and alter the table to drop all of the columns that starts with the string of the user.
How would I do this... right now I am doing it the long way, which is still not working either.
$sql = "ALTER TABLE userDatabase
DROP COLUMN `$user.hour`,
DROP COLUMN `$user.plannerData`,
DROP COLUMN `$user.eventName`,
DROP COLUMN `$user.eventStart`,
DROP COLUMN `$user.eventEnd`,
DROP COLUMN `$user.eventFreq`,
DROP COLUMN `$user.eventSlide`";
Delete all that from your database. create a table with all your necessary fields. and use code for registration.
INSERT INTO `usertable` (
`username`, `hour`, `plannerdata`, `eventname`,
`eventstart`, `eventend`, `eventfreq`, `eventslide`
) VALUES (
'datatoenter', 'datatoenter', 'datatoenter', 'datatoenter',
'datatoenter', 'datatoenter', 'datatoenter', 'datatoenter'
)
To delete the user data, use
DELETE FROM `usertable` WHERE `username` = 'user'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.