global $db question.

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
spyro

global $db question.

Post 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";
}
...
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: global $db question.

Post by calguy1000 »

try:
(when in a module):
$db = $this->GetDb();
$dbresult = $db->Execute( $query );
if( !$dbresult )
{
  $error = $db->ErrorMsg();
}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: global $db question.

Post by Ted »

$gCms->GetDb() doesn't exist in 0.11.2.  Not to be too picky, but some people might not realize...
Locked

Return to “CMSMS Core”