May be there are already solutions of my problem but I don't know what the exact name of my problem. So I can't search them now and I need post my problem here.
When I log in manually(mean putting username & password with my hand), my profile page shows all data correctly from my database. See the below picture....
Now I am logging out and again log in. This time I checked "Remember me box". Then I closed my browser without logging out. So next time I got access to my home page directly as cookies worked. All are fine till now. But the disaster come when I checked my profile page. See the below picture.... :(
I have used "Username" column to detect the row of table of my database. Because my code doesn't allow same username from another user. Here is the code of the profile page:
session_start();
$name = $_SESSION['username'];
$result = mysql_query("SELECT * FROM store WHERE Username='$name'");
while ($row = mysql_fetch_array($result)) {
$first = $row['Firstname'];
$last = $row['Lastname'];
$use = $row['Username'];
$pas = $row['Password'];
}
Then I just echo them (that four variables $first, $last, $use and $pas) in profile page. So what should I do now?