Hi All.

I'm fairly new to coding in Cake and can't find any resource to help
me solve this problem. I appear to be doing the same as all the code
snippets I have seen, but I must be missing something.

The following code

$conditions['AND']['Target.month'] = "BETWEEN $startMonth and
$endMonth";
$targets = $this->Target->findAll($conditions);

produces this SQL

SELECT `Target`.`id`, `Target`.`month`, `Target`.`income-type`,
`Target`.`target`, `Target`.`actual` FROM `targets` AS `Target` WHERE
`Target`.`month` BETWEEN '200707 and 200710'

but this isn't valid.

What I was hoping for was

SELECT `Target`.`id`, `Target`.`month`, `Target`.`income-type`,
`Target`.`target`, `Target`.`actual` FROM `targets` AS `Target` WHERE
`Target`.`month` BETWEEN '200707' and '200710'

Note the extra 2 quotes after the first date and before the second
date.

After giving up on this I tried to solve it by changing the code to
target.month >= '200707' and target.month <= '200710' but I couldn't
work out how to do this either.

I could obviously do either by using a custom sql statement, but that
feels like cheating and isn't going to help me learn whats going on!

Your help is greatly appreciated.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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