Jump to content

Updating A MySql Database


Drezard

Recommended Posts

Hello. What I want to be able to do is.... I have a script that creates a username into the database, I have a second script that updates the script by adding a Nickname and other attributes. I have a third script that the user can change their password.

I only want the User to be able to create there Nickname and other attributes once. So with my Second script i only want it to be able to update an account once. But i want the third script to be able to edit the account as many times as the user wants. Please Help.

Please Help me. Thanks, Daniel
Link to comment
https://forums.phpfreaks.com/topic/10334-updating-a-mysql-database/
Share on other sites

Add a column to your table that stores the nickname called 'locked'.

With your user account script, update the 'locked' field to '0'. Which would mean it is not locked.

With your 2nd script, that allows them to do one update, have the 'locked' field set to '1' when they do their first and only update. Which would mean it is locked.

You would also need to add to your 2nd script a check before the update. You could use an IF or CASE statement to check if 'locked' = '0' then do the update, if 'locked' = '1' then do not do the update.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.