Hmmm.. du siger noget
Måske lige for mange forespørgelser.
Har lavet koden om til denne her
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kalender</title>
</head>
<body>
<a name="kalender" id="kalender"></a>
<?php
//This gets today's date
$date =time ();
//This puts the day, month, and year in seperate variables
$day = date('d', $date);
$month = date('m', $date);
$year = date('Y', $date);
//Here we generate the first day of the month
$first_day = mktime(0,0,0,$month, 1, $year);
//This gets us the month name
$title = date('F', $first_day);
//Here we find out what day of the week the first day of the month falls on
$day_of_week = date('D', $first_day);
?>
<br /><br />
<center><a href="member.php?id=41"><strong>Opret begivenhed</strong></a></center>
<br />
<? if($_GET['status']=='good'){
echo "<center> <strong>Begivenheden er tilføjet!</strong> </center><br>";
} ?>
<table width="100%" border="1" cellspacing="0" cellpadding="0" >
<? echo "<tr><th colspan=3> $title $year </th></tr>" ?>
<tr>
<td width="1%"><font face="Times New Roman, Times, serif"><strong>Dato</strong></font></td>
<td width="3%"><font face="Times New Roman, Times, serif"><strong>Dag</strong></font></td>
<td width="96%"><font face="Times New Roman, Times, serif"><strong>Aktivitet</strong></font></td>
</tr>
<?php
//We then determine how many days are in the current month
$days_in_month = cal_days_in_month(0, $month, $year);
//This counts the days in the week, up to 7
$day_count = 1;
$day_num = 1;
echo "<tr>";
//count up the days, untill we've done all of them in the month
switch($day_of_week){
case "Sun": $blank = 0; break;
case "Mon": $blank = 1; break;
case "Tue": $blank = 2; break;
case "Wed": $blank = 3; break;
case "Thu": $blank = 4; break;
case "Fri": $blank = 5; break;
case "Sat": $blank = 6; break;
}
$dir = $_SERVER['DOCUMENT_ROOT'];
include($dir."/connections/surf_town_mysql.php");
//beholder udvalg1 og udvalg2
$querytest = "SELECT * FROM kalender" or die(mysql_error());
$querytest2 = mysql_query($querytest);
while ( $day_num <= $days_in_month )
{
switch($blank){
case "0": $day_of_week_danish = "Søn"; break;
case "1": $day_of_week_danish = "Man"; break;
case "2": $day_of_week_danish = "Tir"; break;
case "3": $day_of_week_danish = "Ons"; break;
case "4": $day_of_week_danish = "Tor"; break;
case "5": $day_of_week_danish = "Fre"; break;
case "6": $day_of_week_danish = "Lør"; break;
}
echo '<td><font face="Times New Roman, Times, serif"> '.$day_num.' </font></td>';
echo '<td><font face="Times New Roman, Times, serif"> '.$day_of_week_danish.'</font></td>';
echo '<td><font face="Times New Roman, Times, serif"> ';
while($kalender_junk = mysql_fetch_array($querytest2)){
if($kalender_junk['dag']== $day_num && $kalender_junk['maaned']== $month && $kalender_junk['aar']== $year){
echo $kalender_junk["titel"]." - ";}}
echo '</font></td>';
$day_num++;
$day_count++;
$blank=$blank+1;
if($blank>=7){$blank=0;};
//Make sure we start a new row every week
if ($day_count > 1)
{
echo "</tr><tr>";
$day_count = 1;
}
}
?>
</tr>
</table>
</body>
</html>
Der kun et problem ved det det er at den kun kan finde events i den først dato på måneden.
Hvad kan de skyles?
Er den måde jeg søger i array'en forkert eller?