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
Why don't you use the Cakephp ORM ?
--
Thanks,
Bogdan Bursuc!
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
In that SQL error usually says where the error starts. Can u post that too ?
--
Thanks,
Bogdan Bursuc!
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 *
Bogdan, thanks for the reply.
I agree...
Probably should rethink all of it to avoid any custom queries.
Still curious why it isn't working.
Here is more info:
$sql= returnAdvertising
$error = 1064: You have an error in your SQL syntax; check the manual
that corresponds to your
erikober,
I wonder if there is a syntax error higher up in the code. Getting
your function name returned as bad SQL is weird... but not unusual.
I've definitely seen it more than once in my pages.
Anyhoo... this is such a simple query, GO NATIVE! In you're Model,
try:
$this-find('all', array(
You are getting that error because it seems like your model is not
found. Its using the AppModel in its place. Try debugging it.
debug($this-Workpiece);
On May 14, 7:13 pm, dreamingmind dreamingmin...@gmail.com wrote:
erikober,
I wonder if there is a syntax error higher up in the code.