homepage Welcome to WebmasterWorld Guest from 54.81.170.186
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
User CP
tr8er8




msg:3607826
 4:05 am on Mar 22, 2008 (gmt 0)

I have a login/register pages and like it shows what your logged in at the top like "Welcome {username}" and stuff, but how would I make it so a user can edit his information like his password, or his birthday or something?

 

DrDoc




msg:3607831
 4:23 am on Mar 22, 2008 (gmt 0)

You store the info in a database, and you provide a HTML form page. You populate the form with the user's info, and upon submittal you store the information in the database.

tr8er8




msg:3607832
 4:24 am on Mar 22, 2008 (gmt 0)

WOW rofl I know that I need to make it so you can only edit your own information when your logged in only.

eelixduppy




msg:3607837
 4:50 am on Mar 22, 2008 (gmt 0)

tr8er8, I think you might have misunderstood DrDoc's response.

You have information stored in a database for each user of your site. When they login, you should have a similar form to the registration form that gets populated from the data you have for that specific user in your database so that they can make any necessary changes to their information. Upon submitting this form, a query will be sent to the database that will properly UPDATE the table with the new information.

First implement a form that grabs the data from the table and puts it into its respective input fields. Then, build the update query properly and you should be fine. There are a few examples of how this can be done floating around webmasterworld somewhere, so a little search might help you get started.

tr8er8




msg:3607839
 5:01 am on Mar 22, 2008 (gmt 0)

I already did search, what I need is just a php script that can allow it to detect what row the user logged in is, and get all the information for that row. Then Im good from there :)

vincevincevince




msg:3607842
 5:14 am on Mar 22, 2008 (gmt 0)

Read about Sessions and MySQL's SELECT command - that'll get you closer

eelixduppy




msg:3607843
 5:14 am on Mar 22, 2008 (gmt 0)

You should probably be storing the username or ID in a session variable or cookie, in which case you can use that to access the specific row that you need. For instance, a query could look something like the following:

$query = "SELECT * FROM `table_name` WHERE `username` = '".mysql_real_escape_string($_SESSION['username'])."'";

I'm afraid you aren't going to be finding a ready-made script for something like this; you are going to have to do most of this coding, while not a lot, by yourself. Of course, if you need help along the way don't hesitate to ask, but I'd like you to kindly try to implement your own solution first and then we can work from there.

tr8er8




msg:3607847
 5:25 am on Mar 22, 2008 (gmt 0)

Wow thanks elix that is what I needed and yes I have the session and all that set thanks!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved