On Mon, Aug 30, 2010 at 2:21 PM, andres amaya diaz <[email protected]> wrote:
> Hi, i have some filters in the index page of a listing, you can choose all
> of the filters or just one, if i choose all of them they work fine but if i
> only choose one it gives me a blank web page, here is the code:

Have you checked the error logs (both Cake's and the server's)? A
blank page is usually a result of a fatal error.

Also, set debug to 2.


> /app/controllers/quotes_controller.php
> function index() {
>         $this->Quote->recursive = 0;
>         $filters = array();
>
>         if(!empty($this->data['Quote']['desde']) &&
> !empty($this->data['Quote']['hasta'])){
>                $filters[1] = "Quote.fevento BETWEEN
> '".$this->data['Quote']['desde']."' AND
> '".$this->data['Quote']['hasta']."'";
>
>         }

You have a problem here because arrays are zero-indexed. $filters[1]
should be $filter[0], $filters[2] to $filters[1], etc.



>         if(!empty($this->data['Quote']['cliente_id'])){
>             $filters[2] = "Quote.cliente_id =
> ".$this->data['Quote']['cliente_id'];
>
>             $this->set('cliente_id', $this->data['Quote']['cliente_id']);
>             $this->set('autocliente', $this->data['Quote']['autocliente']);
>         }
>
>         if(empty($filters)) {
>             $filters[3] = "WEEK(Quote.fevento) = WEEK(NOW())";
>             $this->set('cliente_id', '');
>             $this->set('autocliente', '');
>         }

Here you're testing if $filters is empty but, if it is, you're
assigning something to $filters[3]. That should be $filters[0], no?


>
>         $filters[4] = "Quote.status = 0";


No test here. What if $filters[0], $filters[1], $filters[2],
and$filters[3] don't exist?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to