Well, I solved my issue making the query with SELECT COUNT(*) to get the selected rows.
Thanks for your advices On 2 abr, 10:28, keogh <[email protected]> wrote: > Thanks Reggie, but the problem is that I have to use CakePHP v1.1.x, > so I need a way to do that query in CakePHP or I need to do the query > but it should return only the affected rows or a resource type which I > can use it to know the affected rows, I don't want that the query > return the data. > > Thanks in advance, > > Regards > > On 1 abr, 18:12, Reggie Mason <[email protected]> wrote: > > > I don't know for CakePHP v1.1.x. However, if you use CakePHP v1.2.2 - > > > -- Here is the User Model > > <?php > > class User extends AppModel { > > public $name='User'; > > public $hasOne=array('Page'=>array( > > 'foreignKey'=>false, > > 'type'=>'INNER', > > 'conditions'=>array('Page.user_id=User.id'), > > ) > > ); > > > }; > > > -- And in the controller > > <?php > > / > > *---------------------------------------------------------------------- > > * file: example_controller.php > > */ > > class ExampleController extends AppController{ > > public $name='Example'; > > public $uses=array(); > > public function index(){ > > $this->User=ClassRegistry::init('User'); > > $this->paginate=array('User'=>array('conditions'=> array ( > > 'Page.status'=>1, > > 'User.username'=>'tehtreag', > > ), > > 'order'=>'User.username', > > 'fields'=>array( > > 'User.id', > > 'User.username', > > 'Page.id', > > ), > > ) > > ); > > debug($this->paginate('User')); > > $this->autoRender=false; > > } > > > That should work. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
