David C
|
| Posted: 05/15/2002, 12:21 PM |
|
I want to do a lookup into another table in the GridFieldBeforeShow() event.
It is not abundantly clear on how this can be achieved in PHP and CCS.
In CC I could use db_get_value() or dlookup(). But in CCS these functions
(common.php) have been replaced with
CCDLookUp($field_name, $table_name, $where_condition, $db)
and
function CCGetDBValue($sql, $db)
They now require a $db connection parameter. Where do I get the $db to pass to
these functions? Can I re-use the $db that is filling the grid? Or will that
alter the query that it is currently being processed?
Or do I instantiate a whole new clsDBBMServer just to do a simple lookup? If I do,
isn't that going to slow things down quite a bit. It's also going to consume
a lot more memory than the old db_get_value() function call. This is going to
have to execute for every row of the grid so it has to be fast as possible.
So can someone tell me how do I do a simple lookup into another table? TIA
|
|
|
 |
Nicole
|
| Posted: 05/16/2002, 2:04 AM |
|
David,
to be able to use CCDlookUp function you should open new db connection (just one line more than in CC), e.g.:
$dbl = new clsDB<connection_name>();
$name_user = CCDlookUp("employee_name", "employees", "employee_id = ". CCGetUserID(), $dbl);
|
|
|
 |
|