NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help with a CakePHP View

Randal Rust randalrust at gmail.com
Thu Apr 30 11:10:16 EDT 2009


We have inherited a Cake app that needs to be up and running by the
end of next week. I downloaded the application and installed it
locally. While running through testing, I discovered that some things
work, and some don't. The particular piece of code that is being
troublesome is this:

$whereClause = '`District`.`id` = "' .
$this->mrClean->sql($this->passedArgs[0]) . '"';
$this->set('district', $this->District->find($whereClause));

$this->passedArgs[0] is an integer, the ID of the record.

If I remove $whereClause from the second line, the view works. But I
get the first record from the database. If I leave it in there, I get
a blank page. I have set debugging to 3, so that if the view works, I
see the SQL query, but that doesn't do me a bit of good if I can't see
why the query seems to fail when an ID is passed.

Any ideas? This should not be this difficult, which only adds to the
frustration. The exact same structure works on other data models, but
not this District model.

-- 
Randal Rust
R.Squared Communications
www.r2communications.com
614-370-0036



More information about the talk mailing list