Tuesday, March 27, 2012

Problems with Find ('all')

Hello everyone,

I need a help with a issue. I´m trying to add another condition to my
Search Function (usuario_busca).

This is the Code in the Controller:

function usuario_busca() {

$this->set('meuPerfil', 1);

if(!empty($this->data['tipo']) AND !empty($this->data['valor'])) {

switch($this->data['tipo']) {

case 'nome':

$dados = $this->Usuario->find('all', array('conditions'=>array(
'or'=>array('nome_usuario LIKE'=>'%'.$this-
>data['valor'].'%','email_usuario'=>$this->data['valor'])),
'order'=>array('descricao_usuario ASC'), 'limit'=>100));

break;

default: break;

}


if(isset($dados) AND !empty($dados)) $this->set('dados', $dados);

$busca = array('valor'=> $this->data['valor']);

$this->set('busca', $busca);

}

else $this->redirect($this->site['url']['site'] . 'usuario/rede/
perfil');

}

}

....

>?

When i entered the value of email or any name, cake retrieve the info
succesfully, but when I try to add more conditions or structures of
the tables and I entered the value throug the View ==> Nothing
Happend , for example

$dados = $this->Usuario->find('all', array('conditions'=>array(
'or'=>array('nome_usuario LIKE'=>'%'.$this->data['valor'].'%',
'ocupacao_usuario'=>$this->data['valor'])), 'religiao_usuario'=>$this-
>data['valor'])), 'email_usuario'=>$this->data['valor'])),
'order'=>array('descricao_usuario ASC'), 'limit'=>100));

I will appreciate if someone can help me.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: