can anyone give me some help on php? i am trying to make a calendar to use with wwwthreads to show birthdays for the users. i am able to show one birthday for each month but not able to show multiple birthdays for each month. can anyone take a peep at my script and see whats up? thanks in advance!
<?
require ("main.inc.php");
$Username = $w3t_myname;
$Password = $w3t_mypass;
$html = new html;
$html -> send_header($config['title'],$Cat,0,$user['U_Username'],$user['U_Password'],0,$user);
// get all the info
if (!$HTTP_POST_VARS) {
$theDate = getdate();
$mon = $theDate["mon"]; // numeric month (1-12)
$month = $theDate["month"]; // display month january, feb..
$year = $theDate["year"]; // 4 digit year (y2k compliant)
}
if ($action = "findDate") {
$theDate = getdate(mktime(0,0,0,$mon,1,$year));
$month = $theDate["month"];
}
// get what weekday the first is on
$tempDate = getdate(mktime(0,0,0,$mon,1,$year));
$firstwday= $tempDate["wday"];
// get the last day of the month
$cont = true;
$tday = 27;
while (($tday <= 32) && ($cont)) {
$tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
if ($tdate["mon"] != $mon) {
$lastday = $tday - 1;
$cont = false;
}
$tday++;
}
?>
<table width="95%" border="0" align="center">
<tr>
<TD ALIGN="CENTER">
<? echo " <b>$month $year</b> "; ?>
</TD>
</tr>
</table>
<table width="95%" border="2" cellspacing=0 cellpadding=2 bordercolor="#000000" align="center">
<tr class="darktable"><th>Sunday</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th></tr>
<? $d = 1;
$thisDay = date('d');
$thisMon = date('n');
$thisMonth = date('F');
$thisYear = date('Y');
$wday = $firstwday;
$firstweek = true;
$query = "
SELECT U_Extra3,U_Extra4,U_Username
FROM w3t_Users
WHERE U_Extra3 = '$mon'
";
$sth = $dbh -> do_query($query);
$birthday = $dbh -> total_rows($sth);
list ($Month,$Date,$Username_p) = $dbh -> fetch_array($sth);
// loop through all the days of the month
while ( $d <= $lastday) {
// set up blank days for first week
if ($firstweek) {
echo "<TR>";
for ($i=1; $i<=$firstwday; $i++) {
echo "<TD> </td>";
}
$firstweek = false;
}
if ($wday==0) {
// Sunday start week with <tr>
echo "<tr>";
}
// print cell
//
echo "<td height="51" valign="top" align="left" width ="14%" class="lighttable">$d.
";
if ($d == $Date)
{
for( $j=0 ; $j <=$birthday ; $j++ ) {
echo "<a href="http://www.extremeforums.org/showprofile.php?Cat=&User=$Username_p">$Username_p's Birthday.</a>";
}
}
else
{
echo " ";
}
echo "</td>";
if ($wday==6) {
// Saturday end week with </tr>
echo "</tr>\n";
}
$wday++;
$wday = $wday % 7;
$d++;
$dbh -> finish_sth($sth);
}
?>
<TR><TD COLSPAN="7" ALIGN="CENTER">Today is <? $dte=date("l, M j, Y"); echo $dte; ?></TD></TR>
<TR bgcolor="navy"><TD COLSPAN="7" ALIGN="CENTER" class="tdheader"><FORM METHOD="POST" ACTION="<? echo $PHP_SELF; ?>">
<INPUT TYPE="HIDDEN" NAME="action" VALUE="findDate">
<BR>
Go To:
<SELECT NAME="mon">
<OPTION VALUE="<? echo $thisMon; ?>"><? echo $thisMonth; ?></OPTION>
<OPTION VALUE="<? echo $thisMon; ?>">--------------</OPTION>
<OPTION VALUE="1">January</OPTION>
<OPTION VALUE="2">February</OPTION>
<OPTION VALUE="3">March</OPTION>
<OPTION VALUE="4">April</OPTION>
<OPTION VALUE="5">May</OPTION>
<OPTION VALUE="6">June</OPTION>
<OPTION VALUE="7">July</OPTION>
<OPTION VALUE="8">August</OPTION>
<OPTION VALUE="9">September</OPTION>
<OPTION VALUE="10">October</OPTION>
<OPTION VALUE="11">November</OPTION>
<OPTION VALUE="12">December</OPTION>
</SELECT>
<SELECT NAME="year">
<OPTION VALUE="<? echo $thisYear; ?>"><? echo $thisYear; ?></OPTION>
<OPTION VALUE="<? echo $thisYear; ?>">--------</OPTION>
<OPTION VALUE="2000">2000</OPTION>
<OPTION VALUE="2001">2001</OPTION>
<OPTION VALUE="2002">2002</OPTION>
<OPTION VALUE="2003">2003</OPTION>
<OPTION VALUE="2004">2004</OPTION>
<OPTION VALUE="2005">2005</OPTION>
</SELECT>
<INPUT TYPE="Submit" VALUE="Find!">
</FORM></TD></TR>
</table>
<?
$html -> send_footer();
?>
[:red]--------------
http://extremeforums.org/index