flower.jason Posted December 5, 2005 Share Posted December 5, 2005 Hi, I have been using php and mySQL for a while now and have had a client ask for something. They have a table with members info already in (a userID, FirstName, LastName, Email, Address, Phone etc.). They want to have these users register, login and be able to change their details. Any ideas on how i should do this. Quote Link to comment https://forums.phpfreaks.com/topic/2983-members-db/ Share on other sites More sharing options...
Zup Posted December 7, 2005 Share Posted December 7, 2005 Have them log in with their username and password. Then present them with a form that they can use to edit their info with. Have the form action link to the same page and use the method "post". At the top of your PHP script, do this: $var = $_POST['var']; Replace var with your variable names, (ie. $FirstName = $_POST['FirstName'] Then connect to your DB and use MySQL to update your members table, like so: $query = "UPDATE users SET FirstName='$FirstName', LastName='$LastName', Address='$Address', Phone='$PhoneNumber' WHERE userID='$ID'"; @MySQL_Query($query) or die ("Error executing query"); Now $ID is going to have to be found when the user logs in since every user should have a unique ID. This can be found with the query: @MySQL_Query("SELECT userID FROM users WHERE username='$user' AND password='$pass'") or die ("Error executing query"); I hope this helps, if you need extra help just ask, but you may have to provide a little more information about your tables and their field names. Quote Link to comment https://forums.phpfreaks.com/topic/2983-members-db/#findComment-10046 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.