Friday, October 25, 2013

Re: Selecting data from DB

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Mariya,

are you looking
a) for Dates of a certain event, which has already passed
or
b) all Eventdates which have passed?

for b you should leave out the id.

Also try creating the date in your controller and add the real date in
your query.


And what exactly is "wrong"?


Anja



Am 25.10.2013 09:36, schrieb Mariya Davis:
> 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
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlJqTE8ACgkQbOdiIJzHNKGgEgCgn/LW68diajZTYTJmQltVapxQ
TyYAoIa5DKifh9JyjNtDKVW4QXrvgP/r
=mCkK
-----END PGP SIGNATURE-----

--
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: