Re: how to get the upcoming birthday using query

2010-01-20 Thread Akeda Bagus
On Wed, Jan 20, 2010 at 3:11 PM, jiru  wrote:
> Haii,
> Plz help me!
>
> The following query retrieve the name and age from a member table
> whose birthdays falling between current date and current date
> +7.Actullay this query is working correctly.But i do'nt know how to
> use this query directly with in the controller.Does anyone know how to
> use the following query in controller and how to get those results in
> the view page.
>
> select name,(YEAR(CURDATE())-YEAR(date_of_birth))
>
> - (RIGHT(CURDATE(),5)
> AS age from members where month(date_of_birth)=month(curdate()) and day
> (date_of_birth) between day(curdate()) and day(curdate()+7) order by
> date_of_birth asc;
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
>
>

This is my suggestion, put your query in your model's method, for example:
In your model :

function getBirthdays() {
return $this->query( "select name,(YEAR(CURDATE())-YEAR(date_of_birth))
  (RIGHT(CURDATE(),5)YourModelName->getBirthdays() ); // just to know how the
result returns

-- 
regards,
gedex

blog: http://gedex.web.id

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


how to get the upcoming birthday using query

2010-01-20 Thread jiru
Haii,
Plz help me!

The following query retrieve the name and age from a member table
whose birthdays falling between current date and current date
+7.Actullay this query is working correctly.But i do'nt know how to
use this query directly with in the controller.Does anyone know how to
use the following query in controller and how to get those results in
the view page.

select name,(YEAR(CURDATE())-YEAR(date_of_birth))

- (RIGHT(CURDATE(),5)Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en