Search code examples
phpfilemaker

Get the results into a session variable causing __PHP_Incomplete_Class Object


Possible Duplicate:
Session, PHP Incomplete Class

Need some help please. I've got the following code, which queries the FileMaker database in PHP.

The query brings up the expected results, and as I want to use those results elsewhere I want to store/cache them in a session. However When I store them in a $_SESSION, I get __PHP_Incomplete_Class Object, but if I print the normal result, it seems to print fine.

This is the code that works and below which doesn't. They are amost identical. Im using FileMakers own PHP installation. PHP 5

Working Code:

if(!session_id()) session_start();

$find = $fm->newFindCommand('Web'); 

$find->addFindCriterion('ID', '=='.$_SESSION['ID']);

$Results = $find->execute();

echo "<pre>";
print_r($Results); // this prints perfectly i.e. FileMaker_Result_Implementation Object
echo "</pre>";

Broken Code:

if(!session_id()) session_start();

$find = $fm->newFindCommand('Web'); 

$find->addFindCriterion('ID', '=='.$_SESSION['ID']);

$Results = $find->execute();

$_SESSION['results'] = $Results;

echo "<pre>";
print_r($_SESSION); //I want to print all the sessions out
echo "</pre>"

Thanks guys.


Solution

  • __PHP_Incomplete_Class means the class is unknown to PHP. Load the class before you start the session and everything should work