Querying the Database?

General project discussion. NOT for help questions.
Post Reply
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Querying the Database?

Post by CWebguy »

When querying the database from something like a UDT, the standard code for a basic query isn't working.

Is there a special code I need?  I searched the docs.

Thanks.
Last edited by CWebguy on Sun Mar 22, 2009 5:46 am, edited 1 time in total.
CMSMS Made
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Querying the Database?

Post by CWebguy »

Sorry, when looking at the error messages, it may be that I just have to open a new connection.  I'll try that now.

But I'm guessing there is a class I can use?

Thanks.
Last edited by CWebguy on Sun Mar 22, 2009 3:16 pm, edited 1 time in total.
CMSMS Made
alby

Re: Querying the Database?

Post by alby »

CWebguy wrote: But I'm guessing there is a class I can use?
Why not look some examples already done?
Search in wiki for share your UDT

Alby
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Querying the Database?

Post by CWebguy »

what something like:

Code: Select all

global $gCms;
$hm =& $gCms->GetHierarchyManager();
$db = &$gCms->db;
?

Thanks.
CMSMS Made
alby

Re: Querying the Database?

Post by alby »

CWebguy wrote: what something like:
Here you have a SELECT and one INSERT

Alby
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Querying the Database?

Post by CWebguy »

cool, so I'm guessing

global $gCms;
$db = &$gCms->db;

creates a connection to the database then?

Thanks.
CMSMS Made
alby

Re: Querying the Database?

Post by alby »

CWebguy wrote: creates a connection to the database then?
better: you use same connection of CMSMS

Alby
User avatar
CWebguy
Forum Members
Forum Members
Posts: 139
Joined: Thu Jul 24, 2008 3:31 am

Re: Querying the Database?

Post by CWebguy »

ok, so this is the right code for a DB connection?

Thanks.
CMSMS Made
Post Reply

Return to “General Discussion”