I know I must be missing something very simple...
This works in the controller:
function indexadvertising($id = null) {
$this->set('image_id', $this->Workpiece->query("SELECT * FROM
`workpieces` WHERE work_id = 3 ORDER BY `adorder`") );
}
I am trying to move the SQL out of the controller and into the model
but this just returns a SQL error that my syntax is incorrect (even
though the query statement is the same in both places.)
This fails:
In Model:
function returnAdvertising() {
$this->query("SELECT * FROM `workpieces` WHERE work_id = 3 ORDER
BY `adorder`");
}
In Controller:
function indexadvertising($id = null) {
$this->set('image_id', $this->Workpiece->returnAdvertising() );
}
Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
Any advice is very much appreciated.
Thanks.
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php