vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Birthdays in Current Month (https://vborg.vbsupport.ru/showthread.php?t=288740)

KatieG 10-07-2012 05:37 AM

Birthdays in Current Month
 
I am trying to display the user birthdays this month

I have done the script below, although there is a birthday set this month
it shows " No Birthdays This Month "

Can anyone help please

Code:

<?php


include("connect.php");


$result = mysql_query("SELECT userid,username,birthday FROM user WHERE MONTH(birthday) = MONTH(NOW())");
    if( mysql_num_rows( $result ) != 0 ) {
        while ( $row = mysql_fetch_array($result))
{
    $userid = $user['userid'];
    $username = $user['username'];
    $birthday = $user['birthday'];
    $birthday = explode("-", $birthday);
    $birthmonth = $birthday[0];
    if ($birthmonth = $month)
    {
        echo "<a href='member.php?u=$userid'>$username</a>,&nbsp;";
    }

}
}
else{
        echo "No Birthdays This Month";
    }
?>


kh99 10-07-2012 10:39 AM

Change your query to use
Code:

...WHERE MONTH(birthday_search) = MONTH(NOW())

(add the _search). I guess it's because the birthday field isn't one of the date formats that MySql will use or something like that. Anyway, I the rest of your code can still use the birthday column if you want.

Tyran1 01-19-2013 10:57 AM

works??

BGObsession 02-16-2014 05:23 PM

I have tried this code and it's not working - thoughts anyone?

ozzy47 02-16-2014 09:49 PM

If the user has, Hide Age and Date of Birth or Display Only Age set, they should not show up.


All times are GMT. The time now is 02:35 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01210 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete