Welcome to WebmasterWorld Guest from 54.196.238.210

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

User CP

     

tr8er8

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

5+ Year Member



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

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

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

5+ Year Member



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

eelixduppy

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

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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

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

5+ Year Member



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

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

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

eelixduppy

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

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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

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

5+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month