
- You are not logged in. | Login
March 5, 2007 7:59 am
- mastaweb99
- Member


Finding out PHPSESSID immediately after session_start
There is such a script:
session_start(); // first (!) session start
echo $PHPSESSID; // here is an error
How can I find out PHPSESSID meaning in such a context?
Thanks.
March 5, 2007 8:03 am
- sam43inwood
- Member


Re: Finding out PHPSESSID immediately after session_start
What do you need this all for?
March 5, 2007 8:07 am
- mastaweb99
- Member


Re: Finding out PHPSESSID immediately after session_start
There are script1 and script2. script1 transmits data to script2 via post. script2 creates table with name PHPSESSID within a base (separate table for each session). The problem is that if there isn’t any session (as an ideal script2 has to start it), the table cannot be created as far as PHPSESSID is not defined. script1 can also start the session but it is not obligatory to be needed and so I want to give this function to script2 i.e. create a session (and a table) when it is really needed.
March 5, 2007 8:12 am
- sam43inwood
- Member


Re: Finding out PHPSESSID immediately after session_start
What a strange idea you have to create a table for each session?
What for do you need a table if you already have got a session?
What do you want to record into this table? Is it impossible to record this into a session?
March 5, 2007 8:19 am
- mastaweb99
- Member


Re: Finding out PHPSESSID immediately after session_start
sam43inwood, there can be too much data for a session and they should be handled somehow… With table everything is much easier in my case.
March 5, 2007 8:21 am
- sam43inwood
- Member


Re: Finding out PHPSESSID immediately after session_start
You’ve invented something strange.
When I see some complicated construction which is not typical for a PHP-beginner I have a doubt concerning conceiving of such actions. And I’m nearly always right.
What type of data is it and why are they difficult to handle?
March 5, 2007 8:22 am
- mastaweb99
- Member


Re: Finding out PHPSESSID immediately after session_start
It will take a long time to explain… it’s rather specific thing for intranet. The matter is that a lot of data should be transmitted to the sessions and there are going to be some tables and I will need unions, joins and a lot of others… Logic on the base level is already written; only PHP is left…
March 5, 2007 8:25 am
- sam43inwood
- Member


Re: Finding out PHPSESSID immediately after session_start
Look up necessary function in the documentation. Although base is synonymic to constancy and session is temporary by definition. It’s a strange combination…
March 5, 2007 8:33 am
- stp2233
- Member


Re: Finding out PHPSESSID immediately after session_start
I also use session in the base. Session and its data are recorded (i.e. if authorized, they are IDs, IP, which language is selected, from where is authorized and so on). It is rather convenient.
March 5, 2007 8:38 am
- mastaweb99
- Member


Re: Finding out PHPSESSID immediately after session_start
base is synonymic to constancy
But at the same time it has temporary tables.
March 5, 2007 8:46 am
- Stre@m
- Member


Re: Finding out PHPSESSID immediately after session_start
But at the same time it has temporary tables.
N tables (N>0) for each session? It’s rather stupid.
March 5, 2007 8:53 am
- mambojim
- Member


Re: Finding out PHPSESSID immediately after session_start
I didn’t realize the problem.
Is such solution right:
session_start(); // first (!) session start
$PHPSESSID=session_id();
echo $PHPSESSID; // there shouldn’t be any error here. And which error could it be?
//I haven’t checked it but it shouldn’t cause any troubles. It doesn’t matter if you start it for the first time or not, everything should work properly.
Using session code for each table should be scaring. Aren’t you afraid that tables will multiply and there will be LOTS of them and it won’t be helped It’s not always easy to trace deletion. Though it’s up to you to decide what to do and how.
If you need each session’s data and you are eager to save them in the base it could be a solution to place them all into one table in which will a field will be to save your session and all its data.
This will help you for sure if you intended to have similar tables’ structure (when you were going to multiply lots of tables)!
March 5, 2007 8:59 am
- sam43inwood
- Member


Re: Finding out PHPSESSID immediately after session_start
This problem was solved long time ago.


