Page 1 of 1

How can I display a certain user after he/she logs in...?

Posted: Wed Aug 09, 2006 11:48 pm
by cturner
How can I display a certain user after he/she logs in then after he/she selects the my account link?
Here is the code that I have been working with but doesn't seem to be working for me:

Code: Select all

require "config2.php";
$usersid = $_POST['usersid'];
$query = "SELECT username, password, email FROM users WHERE username = '$usersid' LIMIT 1";
$result = mysql_query($query) or die("Could not select data from the database because: ". mysql_error());
while($row = mysql_fetch_array($result)){
	echo "<div class=borderbg>";
	echo "<b>Edit your Account</b>";
	echo "<form action=account.php method=post>";
	echo "Username: ".$row['username']."<br> E-mail address: <input name=email type=text value=".$row['email']."><br /><a href=comments.php>Edit comments</a> <br /> Current password: <input name=currentpassword type=text> <br /> New password: <input name=newpassword type=text><br /> Confirm new password: <input name=newpassword2 type=text> <br /> <input name=submit type=submit value=SAVE> <input name=reset type=reset value=RESET>";
	echo "</form></div>";
}
mysql_close();

Posted: Thu Aug 10, 2006 12:40 am
by RobertGonzalez
In order to maintain state, you are going to need to use sessions of some sort. PHP Native sessions are pretty good. You may want to look at those.