1

I'm getting this error:

[17-Oct-2014 08:46:12] WARNING: [pool blah.com] child 43657 said into stderr: 
"NOTICE: PHP message: PHP Notice:  Undefined index: database_geo in /var/blah/site_profile.class.php on line 124"

The error is for the following code and I've put a var_dump() in front of it with the session var:

print '<pre>';
var_dump($_SESSION['database_geo']);
print '</pre>';

    // GEO Distance between Members in KM or Miles
    if($this-true) {
        $sql='SELECT la,b FROM geoWorld WHERE pid=? LIMIT 1;';
        $pds=$database->pdo->prepare($sql); $pds->execute(array($_SESSION['database_geo'])); $row=$pds->fetch();
        $this->geoDistanceToMe = $location->geoDistanceBetweenMembers($this->profileLatitude,$this->profileLongitude,$row['latitude'],$row['longitude'],FALSE);
    }

The page displays fine but the error shows. I can see the variable "$_SESSION['database_geo']" exists as it display sin the var_dump().

Is there any reason why this message would appear of the var exist?

thankyou - confused...

2
  • Is the above snippet complete? Is there any other line between the var_dump and the if clause? There is probably also an unrelated syntax error here $this-true. Commented Oct 17, 2014 at 9:30
  • Correct the error with if($this-true){ and retry your code. Commented Oct 17, 2014 at 9:37

1 Answer 1

3

Use session_start() before entering or getting something from $_SESSION. See this link http://php.net/manual/ro/function.session-start.php

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.