Session Variable Question
Posted: Sun Jul 04, 2010 8:50 pm
I am trying to save an MDB2 prepared statement so that I can reuse it for subsequent requests during a session. But I get the error:
Fatal error: logSqlUpdate(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "MDB2_Statement_mysql" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /home/jcobban/includes/legacy.inc on line 619
What am I doing wrong?
Fatal error: logSqlUpdate(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "MDB2_Statement_mysql" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /home/jcobban/includes/legacy.inc on line 619
Code: Select all
function logSqlUpdate($command, $connection)
{
global $debug;
// prepare the insert
if (!isset($_SESSION['logCmdPrep']))
{
$logCmdText = "INSERT INTO SqlLog (SL_DateTime, SL_Command)
VALUES (NOW(), ?);";
$_SESSION['logCmdPrep'] = $connection->prepare($logCmdText);
}
// perform the update
$result = $_SESSION['logCmdPrep']->execute($command);
if (PEAR::isError($result)) {
die($result->getMessage());
}
if ($debug)
print "<p>logged: $command</p>\n";
} // logSqlUpdate