what im trying to do:
1. register
2.login
3.go to "my profile" where user are able to edit their username, password and so on.

my problem:
i have success to do the register n login page, but after login, the page "my profile couldn't show all the details that the user had key in in the register page.

*all the data had been stored in the database, there is no problem for register and login page. the only problem is i coundn't call out all the details into "my profile" page when the particular user login.

Dani AI

Generated

The behavior described (register/login works but "My Profile" shows no details) commonly comes from the session not being available when the profile page runs. As recommended, the login process must place an identifier (for example, a username or user ID) into the session and then use that value on the profile page. In the code posted by the session is started after includes and output, which prevents the session cookie/headers from being sent. In PHP the session must be started before any output; see session_start.

Other practical issues evident in the posted code: running multiple DB connects/queries when one well-formed query will do, using unquoted array keys (use quoted keys like $row['username']), and passing sensitive data in URLs. Modern best practice is to stop using the old mysql_* API: migrate to PDO or mysqli with prepared statements and use password_hash/password_verify for passwords. See PDO prepared statements and password_hash.

Concise checklist: ensure the login script calls session_start(), sets a session value, then redirects (header + exit) before output; move session_start to the very top of pages; confirm the browser receives the session cookie; fetch the user record using the session identifier and verify the query returned a row; stop sending passwords via GET; and upgrade DB access to prepared statements and hashed passwords for security.

hi..

i can understand ur prob..

after loggin in, did u put your username into the session variable ?

if the login is successful, put the username in the session variable, then redirect the user to the profile page..

there u can get the user name from the session variable, use it in the query to get their own profile , then display..

i hope u understand.. :)

im using dreamweaver cs3, is there any example of doing it that i can refer to?i have put the username in the session variable, i can login and whn i login, it is empty but only a "my profile" show on that page. below are the coding for "my profile" page:

<?php include 'include/header.php'; ?>
<?php 
$user=$_SESSION['username'];

mysql_connect ("localhost", "root", "") or die ('My SQL Error: ' . mysql_error());
mysql_select_db ("telphone");
$fetch = mysql_query("SELECT * FROM `member` WHERE username='$user'") or die("MySQL Login Error: ".mysql_error()); 

while($myfetch=mysql_fetch_array($fetch)){

$id = $myfetch[userId];
}
?>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%"><p><p>
      <p align="center" class="biglabel">My Profile</p>
      <p></p>
<?php
session_start();
$username=$_SESSION['username'];

mysql_connect ("localhost", "root", "") or die ('My SQL Error: ' . mysql_error());
mysql_select_db ("telphone");
$stuff = mysql_query("SELECT * FROM `member` WHERE userId='$id'") or die("MySQL Login Error: ".mysql_error()); 

while($jj=mysql_fetch_array($stuff)){

$userId = $jj[userId];
$username = $jj[username];
$pwd = $jj[pwd];
$email = $jj[email];
$fName = $jj[fName];
$lName = $jj[lName];
$gender = $jj[gender];
$ic = $jj[ic];
$dob = $jj[dob];
$addr = $jj[addr];
$city = $jj[city];
$poscode = $jj[poscode];
$country = $jj[country];
$phnum = $jj[phnum];

echo("<table width=80% border=0 align=center cellpadding=0 cellspacing=0>");
          echo("<tr>");
            echo("<td><table class=table width=100% border=0 cellpadding=3 cellspacing=1>");
                echo("<tr>");
                  echo("<td width=30%>Username</td>");
                  echo("<td width=1%>:</td>");
                  echo("<td width=60%>$jj[username]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>Password</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[pwd]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>E-mail Address</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[email]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>First Name</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[fName]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>Last Name</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[lName]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>Gender</td>");
                  echo("<td>:</td>");
                  echo("<td> $jj[gender]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>IC Number</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[ic]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>Date Of Birth</td>");
                  echo("<td>:</td>");
                  echo("<td> $jj[dob]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>Address</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[addr]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>City / State</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[city]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>Poscode</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[poscode]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>Country</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[country]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>Phone Number</td>");
                  echo("<td>:</td>");
                  echo("<td>$jj[phnum]</td>");
                echo("</tr>");
                echo("<tr>");
                  echo("<td>&nbsp;</td>");
                  echo("<td>&nbsp;</td>");
                  echo("<td><font color='#FFFFFF'>
                            <div align=right>
                             <a href='profile2.php?username=$username&pwd=$pwd'>
                             <input type=submit value='Change Password' name=submit /></a>
                             <a href='profile.php?username=$username&email=$email&fName=$fName&lName=$lName&gender=$gender&ic=$ic&dob=$dob&addr=$addr&city=$city&poscode=$poscode&country=$country&phnum=$phnum'>
                             <input type=submit value='Update Profile' name=submit /></a>
                             </div></td>");
                echo("</tr>");
            echo("</table></td>");
          echo("</tr>");
        echo("</table>");
        }
?>
     </td>
  </tr>
</table>
<br />

<?php include 'include/footer.php'; ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.