For example, I have simle table list (table + paging + filter )

class ArchiveController extends AppController
{
    public $uses       = array('News');
        public $helpers    = array('Javascript', 'Time', 'Pagination');
    public $components = array ('Pagination');

    function index()
        {
                $currentMonth = (int) (empty($this->params['url']['month'])
                                                                ? date('m')
                                                                : 
$this->params['url']['month']);

                $currentYear  = (int) (empty($this->params['url']['year'])
                                                                ? date('Y')
                                                                : 
$this->params['url']['year']);

                $conditions = "MONTH(`created`) = $currentMonth AND 
YEAR(`created`)
= $currentYear";

                $this->Pagination->sortBy        = 'created';
                $this->Pagination->direction = 'DESC';
                $this->Pagination->show = 10;
                $this->Pagination->resultsPerPage = array(10, 50, 100);

        list($order,$limit,$page) = $this->Pagination-
>init($conditions);
                $this->set('news', $this->News->findAll($conditions, NULL, 
$order,
intval($limit), intval($page)));
                $this->set('currentMonth', $currentMonth);
                $this->set('currentYear', $currentYear);
    }
}

So, as you can see, I get filter paramets from URL (GET method) and
place them into options of query.
With number parametrs it's simple - just cast it to integer, but how
coorectly escape in this case strings (some filter subject)?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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