Hi Friends,
Iam very new in cake php.
I need a help on the pagination . Actually iam trying to make a search with
the company and phone number. Iam pasting the code below. When i search with
a company with 'A' iam getting the result which have the compnay name which
starts with A. When i go to the next page the all results are showing (
because query is changing due to compnay values is null). How can i solve it
.
---------------------------------
my controller code
if
($this->data['post']['comp'] !='') {
$datass .=" and posts.body like '%". $this->data['post']['comp']."%'";
}
if($this->data['post']['phone'] !='') {
$datass .=" and posts.active like '". $this->data['post']['phone']."'";
}
$criteria='post.active =1';
list($order,$limit,$page) = $this->Pagination->init($criteria);
$sql = array('conditions' => array($datass),
'recursive' => 1 ,
'fields' => array('posts.*'),
'order' => array( 'posts.id DESC'),
'limit' => $limit,
'page' => $page
);
$tasks = $this->posts->find('all',$sql );
$this->set('results', $tasks);
----------------------
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---