3
Thanks ackbarr
I got up this morning and it works!
From what you say I think I understand what is going on. The server is a development one inside my firewall so that can be discounted. What I have is a script called test.php located in my module directory. It's contents appended below for ref.
I think that if I go to another website first and submit some sort of form then the submit method gets stuck at 'POST', then my script works as expected. If I close the browser and re-open and go straight to my test page, it is getting set as 'GET', the result being that ..dbProxy is instantiated.
I've forced the submit method by setting $HTTP_SERVER_VARS['REQUEST_METHOD'] at the beginning of the script. This seems to work.
Regards
Ashley
>>> test.php
$HTTP_SERVER_VARS['REQUEST_METHOD']='POST';
require("header.php"); //MUST include page header
require XOOPS_ROOT_PATH."/header.php"; // include the main header file
if (isset($codeHandler)) { unset($codeHandler); }
if (isset($code)) { unset($code); }
$codeHandler =& xoops_getmodulehandler("CDMCode");
$code =& $codeHandler->create();
function pp($str) {
global $code;
global $codeHandler;
print($str."
");
$l = ($code->isDirty() ? 'TRUE' : 'FALSE');
$n = ($code->isNew() ? 'TRUE' : 'FALSE');
print("dirty = ".$l."
new = ".$n."
");
$en = @mysql_errno();
$er = @mysql_error();
print("db error = ".$en." - ".$er."
");
$vars = $code->getVars();
print_r($vars);
print( "
");
}
pp('New object instantiated');
$code->setVar('cd','ACC6');
$code->setVar('cd_value','Account#');
$code->setVar('cd_desc','An account in some book-keeping thing');
pp('values set');
//If ..DBProxy is being used the following fails
// but subsequent call to pp() does not show any sql error
// information
if (!$codeHandler->insert($code)) {
print("DB Error on insert/update
");
}
pp('new code inserted to db');
?>