Re: Re: Datagrid

From: Date: Wed, 20 Sep 2006 05:38:25 +0000
Subject: Re: Re: Datagrid
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25180@lists.php.net to get a copy of this message
Chris Boget wrote:
I'm not sure whether I get your question right, but bind() accepts various types of inputs. One type is a query string (like in your example), another one is a DB_DataObject instance (which seems to be what you want to have). You can find more information about SDG & DBDO in a tutorial from Olivier: http://www.samalyse.com/code/pear/dgdo/
You understood my question correctly. My apologies for not being as articulate as I should have been. The link above is an excellent resource. Thank you very much for giving me the pointer. My only remaining question is how to make it so that when the datagrid goes to render the $dataObject, how do you make it so that it returns a particular result (sub)set. The example on the page above looks like it's rendering the result of "SELECT * FROM fruits" What if I wanted it to render the result of, say, "SELECT name, stock, price, ( price * stock) as total_cost from fruits" ? thnx, Chris
You need to need to define such restrictions via DBDO, please have a look at its documentation in the PEAR manual. If you don't need specific features from DBDO, and you just want to use things like the fruits query, you can also go on using the query string in the bind() call. (Refer then to DBQuery / MDB2 DataSource drivers in the SDG documentation.) Regards, Mark P.S.: Please use "Reply all", thanks.

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