tag:help.lighthouseapp.com,2008-09-20:/discussions/questions/1909-search-filter-in-cake-13Lighthouse: Discussion 2013-03-04T23:51:23Ztag:help.lighthouseapp.com,2008-09-20:Comment/255806862013-03-04T23:27:39Z2013-03-04T23:27:41Zsearch filter in cake 1.3<div><p>hi guys,... can anyone help please,... I'm using cake 1.3<br>
how can I filter search results by user firstname</p>
<p>this is my form input:</p>
<pre>
<code><?php echo $this->Form->create('User', array('action' => 'search')); ?>
<?php echo $this->Form->text('find', array('style' => 'width: 60px')) ?>&nbsp;
<?php echo $this->Form->end(__('Search', true)); ?></code>
</pre>
<p>and this is my users_controller.php</p>
<p>function search() {</p>
<pre>
<code>$this->User->recursive = 0;
$params = $this->params['url'];
if (!array_key_exists("find", $params)) {
$this->set('users', $this->paginate());
}
else
{
$this->set('users', $this->paginate(array("User.firstname LIKE '{$params['find']}%'")));
}</code>
</pre>
<p>}</p>
<p>thanks in advance<br>
chris</p></div>chris69mtag:help.lighthouseapp.com,2008-09-20:Comment/255806862013-03-04T23:51:21Z2013-03-04T23:51:21Zsearch filter in cake 1.3<div><p>Chris -</p>
<p>You need to submit this to cakephp.lighthouseapp.com. This is
the support forum for Lighthouse proper.</p>
<p>Thanks,<br>
Nicole</p></div>Nicole