Hello,
I'm trying to generate a query with the following condition:
WHERE Lead.user_id = $user_id
OR (Lead.time_found BETWEEN '$start_time' AND '$end_time' AND
Lead.user_id IN ('0',NULL))
Here is the condition I'm using, but it's not giving the right result.
$conditions[] = array('Lead.user_id'=>$user_id
'or'=>array(
'Lead.time_found'=>'>
'.$this->Session->read('User.start_time'),
'Lead.time_found'=>'<
'.$this->Session->read('User.end_time'),
'Lead.user_id'=>array('0',NULL)
)
);
Here is what I'm getting back:
WHERE (`Lead`.`user_id` = 3) AND (((`Lead`.`time_found` < '09:00:00')
OR (`Lead`.`user_id` IN ('0', NULL) )))
It's leaving out the first start time, and switching some of the AND's
and OR's.
What am I doing wrong?
I've also tried just using BETWEEN '$value' in my query, but it ends
up putting slashes in front of the apostrophes in the sql query which
makes it invalid (ie. BETWEEN \'2008-01-01\' AND \'2008-02-01\')
Any ideas?
Thank you!
Brandon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---