Page 2 of 2
Posted: Mon Sep 17, 2007 7:35 am
by volka
oops, that was stupid of me.
revised version:
Code: Select all
echo '<div>Debug File: "', __FILE__, '@', __LINE__, "\"</div>\n";
echo '<pre>Debug call stack: '; var_dump(debug_backtrace()); echo "</pre>\n";
echo '<pre>Debug _SESSION: '; var_dump($_SESSION); echo"</pre>\n";
$url = $_SESSION['url'];
Posted: Mon Sep 17, 2007 7:54 am
by lyleyboy
Warning: (null)() [function.mysql-free-result]: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0
Posted: Mon Sep 17, 2007 8:02 am
by volka
oh, nav_free.php
What happens here?
php sends a new http request for /includes/nav_free.php to
http://www.flittermouse.com
The server at
http://www.flittermouse.com starts a
new instance of php. This new instance executes nav_free.php
The output of that php instance is sent back to the php instance with the
fopen($File, 'r') code.
Both php instances are not connected to each other - even if they run on the same server. You can see "evidence" of that in the missing call stack
Debug call stack: array(0) {
}
session_start() has to be called for each instance of php that is supposed to access session data.
Why do you request the file include/nav_free.php via http? I thought both files are located at the same server?
Posted: Mon Sep 17, 2007 8:08 am
by lyleyboy
That line is one of my attempts to make it work.
I was trying to read the file into a var rather than using an include to see if that fixed the problem.
I did have the session_start() in the nav_free page but it made no difference.
I am calling things via http because I am trying to make to script easier to maintain and there are lots of pages in a lot of folders. I thought going global would make it easier.
So where do i go from here? All I really want is to pass the $url pulled from the db to the nav_free page where it can then be used to build the urls for the nav page.
Posted: Mon Sep 17, 2007 8:56 am
by volka
lyleyboy wrote:So where do i go from here? All I really want is to pass the $url pulled from the db to the nav_free page where it can then be used to build the urls for the nav page.
Then you do not need a session at all.
Pull the data from the database, then include the other script (without http://)
First step:
replace
by
Code: Select all
die('<div>cwd: ' . getcwd() . '</div>');
// require 'includes/nav_free.php';
JOB DONE
Posted: Mon Sep 17, 2007 11:28 am
by lyleyboy
Thanks for your help.
And the answer was quite simple. all i did was include by ../../ rather than http