Reply to date matching for b-days

Your name:

Reply:


Posted by gagal on 07/17/07 20:09

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]

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация