phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-developers] db object?


From: Peter Moulding
Subject: [Phpgroupware-developers] db object?
Date: Thu, 21 Mar 2002 13:40:21 +1100

I fiddled with db objects in tts but ran aground. Perhaps someone could
provide some guidance on the phpGroupWare way.

I added an extra field, ticket_company, to tts. ticket_company contains
phpgw_addressbook.id. I tried to model it on group so every where group
exists, I copied the code and changed group to company. That worked.

Company has to appear as name so I looked at the accounts code and tried
to use similar code to access phpgw_addressbook.org_name via
phpgw_addressbook.id. That did not work.

To get the code working, I wrote my own function in
tts/functions.inc.php and have the function cache the result from the
top of the page so there are no database accesses when the tts code is
accessing the database.

What I want to do is use the correct phpGroupWare way of accessing a
database from anywhere on a page even when there are other database
actions in progress. I presume that means creating a new db object. Is
there a simple example I can copy in one of the applications?

The data is returned to an array for lookup and is currently stored in a
static variable. It could be of the form:
$GLOBALS['phpgw']['addressbook'][phpgw_addressbook.id]['org_name'] =
"value";
What is the phpGroupWare way of retaining a lookup list for all pages
within one application?

The company name is retrieved from the table multiple times in the tts
ticket view page and there are multiple lookups in the tts index page.
Because of the small number of company names involved, it is more
efficient to perform one SQL request on first usage than to perform a
series of discrete requests. The total list is then used to prime drop
down boxes. There may be other pages where I want just one entry.

Once I get the hang of your db extraction and global table, I should be
able to work on any of the apps.

Peter 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]