session problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

session problem

Post by pleigh »

hi there

just like to know how many sessions can i use in a single page??in my page, i have 3 session keys, but when i added the 4th, it didn't work....pls help

thanks

pleigh
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Not entirely certain I know what you mean?

If you mean actual data appended to the $_SESSION array - this array can hold any number of keys. Some code would give more clues as to what you're trying to do versus the result...
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

thanks,but what should i do?
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

The most obvious question is what the fourth key you added was - how did you add it, what is it, what is the related value? As I said - without an example it's impossible to know what went wrong...
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Please post your code
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

here is wat i did last time, before the problem occur, i have these fields in the users table respectively; userID, firstname, lastname, username, password and email. i used userID, firstname and lastname as a session key. it was working out fine, i was able to call the session keys in my script. then i altered the table, adding another field in the table after the lastname, naming it "company", and i populated the field, i also made it as a session key so i can call the company name in the page and adding the code:

Code: Select all

$_SESSIONї'company'] = $rowї3];
my code before was:

Code: Select all

$_SESSIONї'lastname'] = $rowї2];
$_SESSIONї'firstname'] = $rowї1];
$_SESSIONї'userID'] = $rowї0];
then called my new session key (company) to the handling page. unfortunately, it returned null. i wasn't able to call to my page the company name. the other sessions were fine but the company.

thanks

pleigh
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

and the select you are using to populate these four variables is.....
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

this is my code in calling the firstname and lastname session keys:

Code: Select all

<? echo $_SESSION&#1111;'firstname']." ".$_SESSION&#1111;'lastname']; ?>
then in another table in my html, i did the same for the company:

Code: Select all

<? echo $_SESSION&#1111;'company']; ?>
the first code above works fine except for the company session when calling it in the page.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I said "select" as in query against the database.... :roll:
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

no, i don't have any database query in calling the session keys
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

not in calling them, I'm talking about how they are set/created/born/conceived/sparked/realized/originated ... :roll:
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

i used mysql control center and manually populated the company field without using any syntax
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$row[3] says you didn't "manually" enter the company in the script...
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

u mean the form in the php page that will handle the creation of the info to the database? no, not yet created it, i directly put info to the database
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'm tired of trying to convey this question to you... so I'll make it easy on you, and a bit of a pain for me: post the script.. all of it.
Post Reply