Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Nov 2013
    Posts
    146
    Member #
    37737
    Liked
    15 times

    Retrieve MySQL Data by Session

    Hi,
    I have al ogin system using sessions that works but what I want to do is pull the user's data based on the session.
    So their session contains their unique ID, then every time a page is loaded I can retrieve information from the database based on that.
    This will be used in a helpdesk system.
    So, let's say they go to the home page/dashboard
    I can say Welcome, Examplefirstname! pulling that information from the MySQL databased based on the session's unique ID.
    Also like on the tickets page the list of tickets that have the customers unique ID in the database.
    Thank you.

  2.  

  3. #2
    Senior Member
    Join Date
    Nov 2013
    Posts
    146
    Member #
    37737
    Liked
    15 times
    Okay, I get this now, I use MySQL, but my problem is the session is somehow corrupt. It only shows the first letter of the email address which I'm using for unique identifier...

    PHP Code:
    $email $_SESSION["session"]; 
    then

    PHP Code:
    <h1>Welcome, <?php echo $email ?></h1>
    only shows
    PHP Code:
    Welcome
    when it should show
    PHP Code:
    Welcomechris@example.com 
    Can you help with this? Thanks!

  4. #3
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,731
    Member #
    5580
    Liked
    718 times
    Do this at the top of your script and see what your session contains ...

    <?php
    session_start();
    echo "session contains: ".$_SESSION['session'];
    exit;
    ?>

    I'm guessing it only contains "c" ...
    Your problem is when you saved the session, you only saved "c".





  5. #4
    Senior Member
    Join Date
    Nov 2013
    Posts
    146
    Member #
    37737
    Liked
    15 times
    Thanks mlseim, it's working now!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:05 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com