The $gCms is a global object for
CmsObject class. You need it to get a reference to the ADODB-object when you're about to make queries to the database, e.g.
Code: Select all
global $gCms;
$db =& $gCms->GetDb(); // an ADODB-object reference. Notice that we're using only a reference and thus not creating a new object in memory.
// Now when we have $db available, we can do queries like this:
$query = "SELECT * FROM myspecialtable WHERE username = ?";
$result = array();
$rs = $db->Execute($query,$params['username']);
if($rs && $rs->RecordCount() > 0) {
$result = $rs->GetArray();
}
echo '<pre>';
print_r( $result );
echo '</pre>';
Notice that there's the special array, called $params, I'm using. It hold's the variables you have inputted to your UDT. So if I wanted to get all the results from
myspecialtable where field
username has the value "Bob", I'd call my UDT like this:
I hope this answer is what you needed.