Page 1 of 1

global $db question.

Posted: Sun Feb 26, 2006 9:22 pm
by spyro
Where can I find out more about the $db functions? How would I get the error as ErrorMsg() does not seem to work.

global $gCms;
global $db;
...
$dbresult = $db->Execute($query);

if( !$dbresult ) {
  //$r .= $dbresult->ErrorMsg();
  $r .= "Failure";
}
else {
  $r .= "Success\r";
}
...

Re: global $db question.

Posted: Sun Feb 26, 2006 10:17 pm
by calguy1000
try:
(when in a module):
$db = $this->GetDb();
$dbresult = $db->Execute( $query );
if( !$dbresult )
{
  $error = $db->ErrorMsg();
}

Re: global $db question.

Posted: Tue Feb 28, 2006 6:47 am
by Ted
$gCms->GetDb() doesn't exist in 0.11.2.  Not to be too picky, but some people might not realize...