vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Show today birthdays on a non-vb page (https://vborg.vbsupport.ru/showthread.php?t=75062)

smdani 01-25-2005 07:04 AM

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.

Andreas 01-25-2005 07:20 AM

[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.

smdani 01-25-2005 07:39 AM

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)

Andreas 01-25-2005 08:04 AM

You are only selecting username and userid, but you also try to process birthday ...

smdani 01-25-2005 08:06 AM

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?


All times are GMT. The time now is 12:28 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.01168 seconds
  • Memory Usage 1,726KB
  • 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
  • (1)bbcode_php_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