date matching for b-days

This is a discussion on date matching for b-days within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I'm trying to query my db for all the birthdays in a month and to return that info to ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-17-2007
gagal
 
Posts: n/a
Default date matching for b-days

I'm trying to query my db for all the birthdays in a month and to
return that info to my page. It's changing my currentmonth to match
the stored month and displaying all records with a birthday.

function displayBirthdays($connect, $db_table4)
{
$currentmonth = date("m");
$currentday = date("d");

$sql = "SELECT dob, lastName, firstName FROM $db_table4";
$result = mysql_query ($sql, $connect) or die ('Query failed:
' .mysql_error());
while ($row = mysql_fetch_array($result))
{
$lastname = $row["lastName"];
$firstname = "***";
$dob = $row['dob'];
$month = substr($dob,0,2);
$day = substr($dob,3,2);
if ($currentmonth = $month AND $month != 00)
{
echo "$month ";
echo "$currentmonth ";
echo"$firstname $lastname [$day]<BR>";
}
}
}

Result:

6 06 *** Whitfield [22]
03 03 *** Scanlan [09]
11 11 *** Whitfield [29]
03 03 *** Shive [15]
08 08 *** Keckeisen [22]
05 05 *** Sookram [06]

Reply With Quote
  #2 (permalink)  
Old 07-17-2007
Rik
 
Posts: n/a
Default Re: date matching for b-days

1. Don't multipost.
2. Answered twice in comp.lang.php


--
Rik Wasmus
Reply With Quote
  #3 (permalink)  
Old 07-20-2007
gagal
 
Posts: n/a
Default Re: date matching for b-days

On Jul 17, 4:20 pm, Rik <luiheidsgoe...@hotmail.com> wrote:
> 1. Don't multipost.
> 2. Answered twice in comp.lang.php
>
> --
> Rik Wasmus


I didn't mean to. For some reason I was unable to post in groups.
Kept getting errors. I wasn't sure what went thru.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:14 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0