Undefined variable: _SESSION

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Undefined variable: _SESSION

Postby FvR64 » 18. August 2011 11:09

HI, I receive this note on localhost:

Notice: Undefined variable: _SESSION in C:\xampp\htdocs\villacare\shared\inc\init.inc.php on line 26

When entering the file I read this, where line 26 is : $db = $_SESSION['db'];

$default_delay = 3;
$page_size = 8;

$db = $_SESSION['db'];

$uk = false;
$nl = false;
$fr = false;
$es = false;
$de = false;

Presumebly the original script was made with an a older PHP version and seems not to be supported by the newer versions. Also is it on a localhost as we did not get it working.

Anyone a idea?
FvR64
 
Posts: 2
Joined: 17. August 2011 09:53

Re: Undefined variable: _SESSION

Postby WilliL » 18. August 2011 15:17

error_reporting is changed in newer xampp packages (php.ini).

I would keep this and change code
Code: Select all
if ( !isset($_SESSION['db'])) {
       $db = ""; // or "dummy"
    } else {
        $db = $_SESSION['db'];     
}
Willi
WilliL
 
Posts: 660
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: Undefined variable: _SESSION

Postby Altrea » 18. August 2011 18:59

do you have a
Code: Select all
session_start();

line at the beginning of your script?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Undefined variable: _SESSION

Postby FvR64 » 19. August 2011 08:52

Thanks WilliL, I made the changes and I think it works, I did not receive the note again :)

Thanks Altrea, I tried this before an got another note as it was already written in another script which is part of the whole.

For now I have it working on localhost, now have to get it up end running on the web

Thanks again
FvR64
 
Posts: 2
Joined: 17. August 2011 09:53


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 192 guests