Friday, October 25, 2013

Selecting data from DB

Hi All,

Iam very new in cakephp. Already read the several tutorials.

I have 3 tables:

1. Organziation table

Id   name
---   --------
1    Test

2. Event table

Id   org_id   name 
---   --------- ---------
1    1        events1
2    1        events2

3. Event dates table

Id   event_id   start_date   end_date
---   -----------   ---------------   -------------
1    1            2013-10-01   2013-10-01   
2    1            2013-10-12   2013-10-13   
3    1            2013-12-12   2013-12-13   

So i want to select past events based on todays date.

That means i want to select past events , which the events expired yesterday or today


How can i do this?


I already executed thi scode:

$this->Event->EventDate->find('all', array('conditions' => array('Event.org_id' => $id, 'EventDate.end_date < ' => 'NOW( )')));

But it returns wrong data...

Thanks, 
Mariya


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: