Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 01-25-2005, 07:04 AM
smdani smdani is offline
 
Join Date: Nov 2004
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Show today birthdays on a non-vb page

Hi comunity!
I would like to show TODAY BIRTHDAY's on a non-vb page.
What I dont know how to do is to compare with SQL statment today date DATE(now), with users.birthday_search and find thos users whose celebrate their birthday.
Any help?

Thanks in advance.
Reply With Quote
  #2  
Old 01-25-2005, 07:20 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[sql]SELECT username, userid
FROM user
WHERE birthday_search LIKE date_format( now( ) , '%%-%m-%d' )
[/sql]
But you might also want to take a look at table datastore, row title=birthdaycache.
Reply With Quote
  #3  
Old 01-25-2005, 07:39 AM
smdani smdani is offline
 
Join Date: Nov 2004
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a lot KirbyDE,
It works!! Here is the script for anyone that wants to use it!!

PHP Code:
<?php 
$db_host 
"localhost"
$db_name "***";
$db_user "***"
$db_pw "***";

mysql_connect($db_host,$db_user,$db_pw) or die("Imposible conectar con MySql");
mysql_select_db($db_name) or die("No puedo conectar con la BD");

$birthdays mysql_query("SELECT * FROM user WHERE birthday_search LIKE date_format(now(),'%%%%-%m-%d')");

if (
$birthdays == ""){
        echo 
"No hay cumplea?os";
        } else {

while (
$birthday mysql_fetch_array($birthdays)) {
    
$bd_user $birthday[username];
    
$bd_userid $birthday[userid];
    
$datebits explode("-"$birthday[birthday_search]);
    
$bdage date("Y") - $datebits[0];
    if (
$bdage 0$age "($bdage)";
    else 
$age "";
    echo 
"<a href=\"$forum_url/member.php?u=$bd_userid\">$bd_user</a> $age<br>"
    }

?>
Thanks!!!
"Dad gratis lo que gratis recibisteis" (Jes?s)
Reply With Quote
  #4  
Old 01-25-2005, 08:04 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are only selecting username and userid, but you also try to process birthday ...
Reply With Quote
  #5  
Old 01-25-2005, 08:06 AM
smdani smdani is offline
 
Join Date: Nov 2004
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Corrected and modified above message with correct code!
Thanks

Now I would like to limit birthday show to those users who belongs to a special category created by me on the system.
any idea?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:46 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05071 seconds
  • Memory Usage 2,199KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete