Previous Thread
Next Thread
Print Thread
Rate Thread
#207689 01/20/2001 2:46 PM
Joined: Aug 2000
Posts: 262
Enthusiast
Enthusiast
Offline
Joined: Aug 2000
Posts: 262
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
Attachments
28953-calendar.php.txt (0 Bytes, 10 downloads)

Sponsored Links
Entire Thread
Subject Posted By Posted
Calendar script, please help poil 01/20/2001 9:46 PM
Re: Calendar script, please help poil 01/25/2001 7:45 PM
Re: Calendar script, please help Rick 01/26/2001 5:01 PM
Re: Calendar script, please help poil 01/26/2001 6:04 PM
Re: Calendar script, please help Rick 01/31/2001 6:21 AM
Re: Calendar script, please help poil 04/06/2001 10:54 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)