wanaka
|
| Posted: 05/05/2002, 6:43 PM |
|
what is the equivalent for the following line in CCS
$last_value=dlookup("customer","cust_name",$compare);
|
|
|
 |
Nicole
|
| Posted: 05/07/2002, 1:43 AM |
|
Hello,
if you look at common file you'll see that CCDLOOkUP() function requires 4 parameters. The last one is db connection. To be able to use CCDlookUP() in custom event, you should open connection first, e.g.:
$dbl = new clsDB<connection_name>();
$last_value = ("lookup_field_name", "table_name", "where_clause", $dbl);
|
|
|
 |
Jean-Michel
|
| Posted: 08/09/2002, 4:41 PM |
|
Thanks Nicole, I had the problem and your post helped me a lot.
In use the CCDLookup function in a header page having no class defined, to retrieve the first and last name of the logged user, accessing a user table with a where clause on the session UserLogin. The problem was that, some pages including this header did not use the connection accessing the database where the users table is stored, so when the header page was loaded I was getting an error because the connection object instance had not been created.
I solved the problem by adding lines 3 and 4 to my code:
1 global $my_data_connection_object;
2 ...
3 if(!is_object($my_data_connection_object))
4 $my_data_connection_object = new clsDB<connection_name>();
5 ...
6 CCDLookup
7 ("last_name",
8 "members",
9 "member_login='".CCGetSession("UserLogin")."'",
10 $my_data_connection_object);
If $my_data_connection_name has been created by the calling page, the added code does nothing, if it has not it creates the instance of the connection object.
Hope it helps.
|
|
|
 |
|