> Hi,I have problem in search. > // in the model > function doSomething() { > $this->query('select * from basicdetail'); > } > > // in the controller > function searchtry(){ > return $this->MyModel->doSomething(); > } > but in searchtry.ctp I can't get my data, I've checked through > logerror and I got that my for loop is running under .ctp but I'm not > getting data > >
You have to set your data for your view. This would make more sense in CakePHP: Model: function search(){ $results = $this->find('all', array(...)); return $results; } Controller: function searchtry(){ $this->set('results', $this->Model->search()); } View: foreach($results as $result){ echo $result['Model']['field0']; ... } See: http://book.cakephp.org/view/10/Understanding-Model-View-Controller http://book.cakephp.org/view/73/Retrieving-Your-Data http://c7y.phparch.com/c/entry/1/art,mvc_and_cake --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---