Updating individual account details

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasonmc
Forum Newbie
Posts: 7
Joined: Wed Oct 06, 2010 5:02 am

Updating individual account details

Post by jasonmc »

Hi I am currently building a website (PHP/MYSQL etc) and I have a registration page, login etc, and a page where members can update their details. The way I have done it is a member can view their details on a page which has a link at the bottom to edit their details (and another to close their account). If they click edit details, they are taken to a new page where they have another registration form (table) to fill in which updates their details accordingly (with the usual checks for duplicates etc).
I was wondering if anybody is aware of a way of rather than going to another page, i could have text areas in the table which displays existing details where the user can type in a new detail and click an individual update button for each detail (without navigating away from the page or update all the fields).
Many thanks in advance for any advice :)
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Updating individual account details

Post by Jonah Bron »

I would send them to another page to edit their details. But instead of giving them a bunch of empty boxes, fill them with the details that the user already has. For example:

Code: Select all

<input type="text" name="email" value="<?php echo $current_email; ?>" />
Of course, you would define $current_email before this point by grabbing it from the database.
jasonmc
Forum Newbie
Posts: 7
Joined: Wed Oct 06, 2010 5:02 am

Re: Updating individual account details

Post by jasonmc »

Many thanks for the reply Johan. I have just tried this approach which would be ideal for what i want, but i have a problem with it.
When i try and echo a value back from the database it displays: 'Resource id #6'...if i echo something else it says 'Resource id #7' etc...I have no idea what this means or what is causing it.

The code i am using is something like this:

$mail=($_SESSION['username']); //session username is activated on login and works fine
$email=mysql_query("SELECT email FROM users where username = '$mail';")or die(mysql_error());
echo $email; //this displays resource id

If you have any more advise it is very, very much appreciated. Thank you.
jasonmc
Forum Newbie
Posts: 7
Joined: Wed Oct 06, 2010 5:02 am

Re: Updating individual account details

Post by jasonmc »

Forget that Johan I got it working with mysql_assoc instead of mysql_query...thank's again for the advice its much appreciated!
Post Reply