FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » get members who have birthday this week
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
get members who have birthday this week [message #174728] Wed, 29 June 2011 21:20 Go to next message
Co is currently offline  Co
Messages: 75
Registered: May 2011
Karma: 0
Member
Hi All,

I want to display all members who have their birthday the coming week.
I tried some code but it doesn't return any records. Probably because
it looks for the date of birth
instead of just the month and day:

$today = date("d-m-Y");
$birthday = $row['birthday'];

$sql = mysql_query("SELECT * FROM myMembers WHERE birthday BETWEEN
$today AND $today+7");

Can anyone help me out here?

Marco
Re: get members who have birthday this week [message #174729 is a reply to message #174728] Wed, 29 June 2011 21:29 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/29/2011 5:20 PM, Co wrote:
> Hi All,
>
> I want to display all members who have their birthday the coming week.
> I tried some code but it doesn't return any records. Probably because
> it looks for the date of birth
> instead of just the month and day:
>
> $today = date("d-m-Y");
> $birthday = $row['birthday'];
>
> $sql = mysql_query("SELECT * FROM myMembers WHERE birthday BETWEEN
> $today AND $today+7");
>
> Can anyone help me out here?
>
> Marco

This is a MySQL question, not a PHP one (hint: PHP knows NOTHING about SQL).

I would suggest you ask in comp.databases.mysql.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: get members who have birthday this week [message #174730 is a reply to message #174728] Wed, 29 June 2011 21:59 Go to previous message
dougatmilmacdotcom is currently offline  dougatmilmacdotcom
Messages: 24
Registered: May 2011
Karma: 0
Junior Member
In article <252495a8-76a0-41c0-bc2a-4c3f9b3e189b(at)j15g2000yqf(dot)googlegroups(dot)com>, Co <vonclausowitz(at)gmail(dot)com> wrote:
> Hi All,
>
> I want to display all members who have their birthday the coming week.
> I tried some code but it doesn't return any records. Probably because
> it looks for the date of birth
> instead of just the month and day:

So fix your query so it looks for what you want it to look for. And post in
the proper newsgroup -- this is NOT a PHP issue.
>
> $today = date("d-m-Y");
> $birthday = $row['birthday'];
>
> $sql = mysql_query("SELECT * FROM myMembers WHERE birthday BETWEEN
> $today AND $today+7");
>
> Can anyone help me out here?

I'd love to help you out -- which way did you come in?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how to unset session variable when leaving page
Next Topic: Windows binaries for the SAM (Simple Asynchronous Messaging for PHP) extension
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 12:35:54 GMT 2024

Total time taken to generate the page: 0.02927 seconds