I'm pretty new to cakephp, so theres a good chance this is a dumb
question, but I haven't been successful in finding my answer in any of
the docs.

I'm searching a table using "find" and my params are being submitted
from an html form.  This is working just fine (kinda) using this code:


$formSchools = $this->data['schools'];

$conditions = array(
        'School.zip_mail' => $formSchools['zip_mail']
        ,'School.name' => $formSchools['name']
);

$this->set('querySearchSchools', $this->School->find($conditions));



However the problem lies in that that name input field is *not*
required.  So if I submit a form with zip = 00001 and name = [empty
string]

the SQL equivalent is obviously,
        SELECT *
        FROM schools
        WHERE zip_mail = 00001
        AND name = ''

This is obviously wrong because I only want the last AND condition if
name is not empty.  So i'm not sure where to go from here...

Any pointers would be *greatly* appreciated.. even a "dude, you're way
off" would be helpful ;)

Thanks

--~--~---------~--~----~------------~-------~--~----~
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