Page 1 of 1
Querying the Database?
Posted: Sun Mar 22, 2009 5:39 am
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.
Re: Querying the Database?
Posted: Sun Mar 22, 2009 2:54 pm
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.
Re: Querying the Database?
Posted: Sun Mar 22, 2009 3:22 pm
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
Re: Querying the Database?
Posted: Sun Mar 22, 2009 5:07 pm
by CWebguy
what something like:
Code: Select all
global $gCms;
$hm =& $gCms->GetHierarchyManager();
$db = &$gCms->db;
?
Thanks.
Re: Querying the Database?
Posted: Sun Mar 22, 2009 5:22 pm
by alby
CWebguy wrote:
what something like:
Here you have a SELECT and one INSERT
Alby
Re: Querying the Database?
Posted: Tue Mar 24, 2009 4:34 pm
by CWebguy
cool, so I'm guessing
global $gCms;
$db = &$gCms->db;
creates a connection to the database then?
Thanks.
Re: Querying the Database?
Posted: Tue Mar 24, 2009 8:39 pm
by alby
CWebguy wrote:
creates a connection to the database then?
better: you use same connection of CMSMS
Alby
Re: Querying the Database?
Posted: Tue Mar 24, 2009 9:23 pm
by CWebguy
ok, so this is the right code for a DB connection?
Thanks.