DB_DataObject: how to implement a calculated data inside a object FROM another

From: Date: Sat, 05 Jun 2004 15:39:22 +0000
Subject: DB_DataObject: how to implement a calculated data inside a object FROM another
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12928@lists.php.net to get a copy of this message
HI, Im using DB_DataObject only in a basic approach, now I want to "updgrade" mi skill with this. Suppose I have a database with data about people and an account of credit and purchases for each one. Say, table people id int(6) name varchar(20) table movements id int(10) id_people int(6) amount float(8,2) The real thing uses more fields and tables, but for purposes of simplicity i think is enough. Each row of "movements" will point to a given "people" via the foreign key "id_people" and the amount can be > 0 if the movement is a credit or <0 if is a debit(a purchase), so to know the status of the account of a given people with id=345, I do: select sum(amount) from movements where id_people=345 What I want, is a "status" data in the people dataobject that do that, a query over movements to get that sum(amount). How that can be do? PS: Excuse for my english :P ------------ Contanos cómo usás el correo electrónico, qué pensás del spam y de los virus. Encuesta de Correo Yahoo! Participá en http://ar.surveys.yahoo.com/ar_mailpr2

« previous php.pear.general (#12928) next »