Page 1 of 2

session problem

Posted: Mon Feb 14, 2005 4:53 am
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

Posted: Mon Feb 14, 2005 5:20 am
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...

Posted: Mon Feb 14, 2005 5:46 am
by pleigh
thanks,but what should i do?

Posted: Mon Feb 14, 2005 6:06 am
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...

Posted: Mon Feb 14, 2005 7:12 am
by Chris Corbyn
Please post your code

Posted: Mon Feb 14, 2005 11:45 pm
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

Posted: Mon Feb 14, 2005 11:48 pm
by feyd
and the select you are using to populate these four variables is.....

Posted: Mon Feb 14, 2005 11:54 pm
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.

Posted: Mon Feb 14, 2005 11:57 pm
by feyd
I said "select" as in query against the database.... :roll:

Posted: Tue Feb 15, 2005 12:00 am
by pleigh
no, i don't have any database query in calling the session keys

Posted: Tue Feb 15, 2005 12:03 am
by feyd
not in calling them, I'm talking about how they are set/created/born/conceived/sparked/realized/originated ... :roll:

Posted: Tue Feb 15, 2005 12:05 am
by pleigh
i used mysql control center and manually populated the company field without using any syntax

Posted: Tue Feb 15, 2005 12:08 am
by feyd
$row[3] says you didn't "manually" enter the company in the script...

Posted: Tue Feb 15, 2005 12:16 am
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

Posted: Tue Feb 15, 2005 12:19 am
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.