Vars not getting returned.

I'm not getting vars back from a user file.  $_SESSION['Company_ID'] comes back as blank, but the other $_SESSION vars are ok.

Here's a screen print from the var(dump)
array(56) { ["User"]=> string(6) "BREEZE" ["Password"]=> string(6) "351CLV" ["First_Name"]=> string(5) "Glenn" ["Last_Name"]=> string(8) "Davidson" ["E_Mail"]=> string(21) "glenn@langsystems.net" ["Security"]=> string(1) "9" ["P_Format"]=> string(1) "5" ["UserID"]=> string(4) "GJJD" ["LSI_Ver"]=> string(3) "4.1" ["Menu_No"]=> int(1) ["Last_Page"]=> string(9) "index.php" ["Save_Last"]=> string(0) "" ["Message"]=> string(0) "" ["Error"]=> string(1) "N" ["PForm"]=> string(1) "N" ["Survey_Count"]=> string(1) "0" ["Number"]=> string(0) "" ["Street"]=> string(0) "" ["Address"]=> string(0) "" ["Data"]=> string(0) "" ["Old_Data"]=> string(0) "" ["Misc"]=> string(0) "" ["Insert"]=> string(1) "N" ["Count"]=> string(1) "0" ["Up_Down"]=> string(0) "" ["North"]=> string(0) "" ["South"]=> string(0) "" ["East"]=> string(0) "" ["West"]=> string(0) "" ["Map_Dir"]=> string(0) "" ["Location"]=> string(1) "M" ["District"]=> string(0) "" ["UNI_Q"]=> string(0) "" ["Logo"]=> string(0) "" ["Food"]=> string(1) "N" ["Vent"]=> string(1) "N" ["Corner"]=> string(1) "N" ["Company"]=> string(1) "N" [u]["Company_ID"]=> string(0) "" ["Comp_ID"]=> string(0) "[/u]" ["Browser_Name"]=> string(15) "Mozilla Firefox" ["Browser"]=> string(7) "Firefox" ["Browser_Version"]=> string(4) "59.0" ["Platform"]=> string(7) "windows" ["Custom1_Name"]=> string(0) "" ["Custom1_Php"]=> string(0) "" ["Custom2_Name"]=> string(0) "" ["Custom2_Php"]=> string(0) "" ["Back_R"]=> string(2) "77" ["Back_G"]=> string(3) "148" ["Back_B"]=> string(3) "255" ["Fore_R"]=> string(3) "255" ["Fore_G"]=> string(3) "255" ["Fore_B"]=> string(3) "255" ["Logo_Print"]=> string(35) "L a n g S y s t e m s , I n c ." ["Logo_PDF"]=> string(17) "Lang_Logo_PDF.jpg" } 

Open in new window

Here's a simple query with the results:
SELECT `First Name`, `User_ID`, `Password`, `Company_ID` FROM users WHERE USER = 'BREEZE' and PASSWORD = '351CLV'

Open in new window


Glenn 	GJJD 	351CLV 	10018855

Open in new window


I'm attaching the index.php and the LoginChk.php.  I did have this working.  I don't know what I screwed up.
index.php
LoginChk.php
breeze351Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim RiddlesPrepress/OMS SpecialistCommented:
The first thing that I would do is var_dump the $ROW variable and see what the value is for $ROW['Company_ID'];  It appears to be empty.
0
Chris StanyonWebDevCommented:
In your LoginChk.php file you do a query and set some SESSION values from the DB. You then redirect to index.php where you set some more SESSION variables. One of those is Company_ID, so whatever value you assigned to it from the database (in LoginChk) you then overwrite with the value from index:

$_SESSION['Company_ID'] = "";
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
Suggestion: Instead of creating numerous SESSION variables store your session in a single session object (stdClass or array).

Then save that to the session. Makes for much easier management.
1
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

breeze351Author Commented:
I just got it.  A-hole partner added $_SESSION['Company_ID'] = "";  to index.php.  Can I kill him?
0
Julian HansenCommented:
Can I kill him
Nope, sorry he is destined for promotion.
1
Chris StanyonWebDevCommented:
Why have accepted the answer you have when I told you exactly what the problem was and you've just confirmed it ???
1
Jim RiddlesPrepress/OMS SpecialistCommented:
I was wondering the same thing, Chris.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.