BlackIbanez Posted April 7, 2007 Share Posted April 7, 2007 I have 2 fields on my "users" row. 1 is for the birthday (1-31) 1 is for the month (1-12) I'd like to make a birthday query, to show the members with birthdays corresponding a certain day. I have the following code. But it does not work... <? $date = getdate(); $day = $date['mday']; $month = $date['mon']; $result = mysql_query("SELECT user, birthday, birthmonth FROM users WHERE birthday=$day AND birthmonth=$month"); if(mysql_query($result) != 0) { while($var = mysql_fetch_array($result)) { $happybday .= "$comma $var[user]"; $comma = ", "; } $happybday .= ""; } ?> Any input is appreciated! Thanks! Link to comment https://forums.phpfreaks.com/topic/46029-querying-birthday/ Share on other sites More sharing options...
clown[NOR] Posted April 7, 2007 Share Posted April 7, 2007 what's the value of $date['mday']; and $daye['mon']; i would maybe do something like this: $day = date("d"); $month = date("m"); Link to comment https://forums.phpfreaks.com/topic/46029-querying-birthday/#findComment-223648 Share on other sites More sharing options...
BlackIbanez Posted April 7, 2007 Author Share Posted April 7, 2007 I actually put: $day = date("j"); $month = date("n"); but even with that it does not work. I think it might have something to do with the query... Link to comment https://forums.phpfreaks.com/topic/46029-querying-birthday/#findComment-223654 Share on other sites More sharing options...
clown[NOR] Posted April 7, 2007 Share Posted April 7, 2007 maybe... and I've never worked with MySQL... so that's out of my field... good luck anyway tho =) Link to comment https://forums.phpfreaks.com/topic/46029-querying-birthday/#findComment-223656 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.