Jump to content

Members Db


flower.jason

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.