Re: selectAdd() PEAR

From: Date: Mon, 20 Aug 2007 15:55:42 +0000
Subject: Re: selectAdd() PEAR
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27836@lists.php.net to get a copy of this message
Adrian Walls wrote:
I am trying to run the following query: "SELECT SQL_CALC_FOUND_ROWS * FROM prop WHERE xyz..." Using the pear db object as follows:
$propDO = new DAO_Prop(); $propDO->selectAdd('SQL_CALC_FOUND_ROWS()'); $propDO->deleted = 0; $propDO->valuation = 0; $propDO->limit($currentIndex,$limit); $propDO->find(); However this does not run my query as expected. When I debug the code the query being executed is: "SELECT * , SQL_CALC_FOUND_ROWS FROM prop WHERE xyz..." It does not appear to build the query with the selectAdd() correctly. Am I missing something? I would appreciate if someone could shed some light on this problem.
selectAdd() *adds* to the *end* of the current select statement, which is by default '*'. If you want to remove the *, do a selectAdd() (with no arguments) before your selectAdd call. By the way, here's a tip: so that you don't have to include each individual dataobject file when instantiating the dataobjects, use DB_DataObject::factory('prop'). -- David Sanders shangxiao

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