Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    Dark Side of the Moon
    Posts
    987
    Plugin Contributions
    1

    Default Need help adding $_SESSION variable

    I have added two fields to my customers table: customers_account_name & customers_account_number

    I want to add these as $_SESSION variables at login, so I edited /includes/modules/pages/login/header.php and added the following code:

    about line 47: get customer info
    Code:
        // Check if email exists
        $check_customer_query = "SELECT customers_id, customers_firstname, customers_lastname, customers_password,
                                        customers_email_address, customers_default_address_id,
                                        customers_authorization, customers_referral, 
    			  	    customers_account_number, customers_account_name
                               FROM " . TABLE_CUSTOMERS . "
                               WHERE customers_email_address = :emailAddress";
    about line 84: create session variables
    Code:
            $_SESSION['customer_id']                 = $check_customer->fields['customers_id'];
            $_SESSION['customer_default_address_id'] = $check_customer->fields['customers_default_address_id'];
            $_SESSION['customers_authorization']     = $check_customer->fields['customers_authorization'];
            $_SESSION['customer_first_name']         = $check_customer->fields['customers_firstname'];
            $_SESSION['customer_last_name']          = $check_customer->fields['customers_lastname'];
            $_SESSION['customer_country_id']         = $check_country->fields['entry_country_id'];
            $_SESSION['customer_zone_id']            = $check_country->fields['entry_zone_id'];
            // added fields
    	$_SESSION['customers_account_number']    = $check_customer->fields['customers_account_number'];
    	$_SESSION['customers_account_name']      = $check_customer->fields['customers_account_name'];
    This DOES create the $_SESSION[] variables, but they are empty. It looks straight forward, so I don't know what I'm missing.

    I can echo any of the other $_SESSION variable and get the expected value, so I don't know why these two are blank when the values are entered correctly in the customers table...????

    Would really appreciate any help getting this right!

    Thanks,
    Chadderuski

  2. #2
    Join Date
    Apr 2006
    Location
    Dark Side of the Moon
    Posts
    987
    Plugin Contributions
    1

    Default Re: Need help adding $_SESSION variable

    It seems the specific issue is that:

    $check_customer->fields['customers_account_number']
    $check_customer->fields['customers_account_name']

    is not returning my data, but I don't know why... ???

  3. #3
    Join Date
    Apr 2006
    Location
    Dark Side of the Moon
    Posts
    987
    Plugin Contributions
    1

    Default Re: Need help adding $_SESSION variable

    Doh! Okay, just ignore this... I somehow managed to leave those two fields empty so NO there wouldn't be anything there!

    Up too late celebrating the BLACKHAWKS!

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Need help adding $_SESSION variable

    Thanks for the update and explaining the issue of the missing data ... this actually can be of great help to others to see how things like this can and do happen ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Apr 2006
    Location
    Dark Side of the Moon
    Posts
    987
    Plugin Contributions
    1

    Default Re: Need help adding $_SESSION variable

    For sure!

 

 

Similar Threads

  1. Replies: 2
    Last Post: 9 Sep 2014, 10:52 AM
  2. Replies: 19
    Last Post: 25 Feb 2011, 03:17 AM
  3. Need variable help
    By dbltoe in forum Contribution-Writing Guidelines
    Replies: 6
    Last Post: 2 Jan 2009, 08:50 AM
  4. Replies: 0
    Last Post: 23 Nov 2006, 08:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg