0 Replies Latest reply on May 18, 2009 12:41 AM by David_Powers

    Displaying the user's name after logging in (PHP)

    David_Powers Adobe Community Professional

      In PHP/MySQL, Dreamweaver creates a session variable called $_SESSION['MM_Username']. You can use this in any page that uses sessions to display the username. You can also use it to create a recordset that contains other details associated with the user. To do so, set the Filter in the Recordset dialog box to use a Session Variable and enter MM_Username in the field alongside, like this:


      Once you have created the recordset, you can use it to display the user's name. For example, if your recordset dialog box looks like the preceding screenshot, this is how you might greet a user:

      <?php echo 'Welcome, ' . $row_getUserDetails['first_name'] . ' ' . $row_getUserDetails['family_name']; ?>

      You need to create the recordset only on the first page the user visits after logging in. Use the results of the recordset to create session variables that can be used in any other page that uses sessions. For example, you can create a session variable for the user's full name like this:

      $_SESSION['fullName'] = $row_getUserDetails['first_name'] . ' ' . $row_getUserDetails['family_name'];

      Thereafter, you can use $_SESSION['full_name'] in any page that uses sessions.