Ich bitte Dich um die genaue Fehlermeldung
@hand Dein Kalender-Script
Einklappen
X
-
Fehler ?
hallo habe mir das mal alles kopiert und idst ja ein schönes script nur bekomme ich immer die fehler meldung wie bei Skaschy beschrieben
in zeile 101
Zeile 101
PHP-Code:foreach ($tag as $padday)
fehlermeldung ist:
PHP-Code:Warning: Invalid argument supplied for foreach() in /home/www/web22/html/test/kalender.php on line 101
weiß da einer eine lösung ?
gruß angie
Kommentar
-
setz das mal bitte hinter:PHP-Code:while ($row = mysql_fetch_array($found)) {
$tag[] = $row[SqlTag];
$subj[] = $row[termSubject];
}
PHP-Code:echo "<pre>";
print_r($tag);
echo "</pre>";
Kommentar
-
halo wurzel,
habe das eingefügt wie du gesagt hast aber bekomme jetzt die gleiche meldung nur mit fehler zeile 103 und das ist die gleiche wie vorher auch.
und sie sieht dann die html aus.
<style type="text/css">
TD, TH {
FONT-FAMILY: Arial, Verdana, Trebuchet MS, Helvetica;
FONT-SIZE: 8pt;
FONT-WEIGHT: none;
COLOR: black;
BACKGROUND-COLOR: #FBFBFD;
}
.alt {BACKGROUND-COLOR: #E7E7F1;}
.basic {COLOR: white; BACKGROUND-COLOR: #606096;}
.top {COLOR: black; BACKGROUND-COLOR: #A3A3CB;}
.white {BACKGROUND-COLOR: #FFFFFF;}
.blank {BACKGROUND-COLOR: white;}
A:link, A:visited, A:active {
COLOR: #000020;
TEXT-DECORATION: underline;
}
A:hover {
COLOR: #FF4400;
}
</style>
<pre></pre><table border="0" cellspacing="0" cellpadding="0" width="150">
<tr>
<td class=basic>
<table width="150" border="0" cellspacing="1" cellpadding="3">
<tr>
<th class=top colspan=7> <font color="#000000"><b>08.10.2003</b></font></th>
</tr>
<tr>
<td><font size='1'>Mo</font></td><td><font size='1'>Di</font></td><td><font size='1'>Mi</font></td><td><font size='1'>Do</font></td><td><font size='1'>Fr</font></td><td><font size='1'>Sa</font></td><td><font size='1'>So</font></td> </tr>
<tr>
<td class=white> </td><td class=white> </td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td></TR><TR>
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td></TR><TR>
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td></TR><TR>
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td></TR><TR>
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td><br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/www/web22/html/xx/kalender.php</b> on line <b>103</b><br />
<td white><font size='1'></font></td></TD>
<td class=white> </td><td class=white> </td></tr><tr><TD colspan=7 class=white><center><FONT SIZE=-2><A HREF='?year=2003&month=9&day=1'>backw</A> | <A HREF='?year=2003&month=10&day=8'>today</A> | <A HREF='?year=2003&month=11&day=1'>forw</A></FONT></TD>
Kommentar
-
gut.
$tag sollte ein array sein, existiert aber nicht.
setz das mal bitte ein anstelle der jetzigen einträge:PHP-Code:echo $select = "SELECT DATE_FORMAT(termStart,'%d') as SqlTag, termSubject
FROM termine
WHERE
DATE_FORMAT(termStart,'%Y') = $year AND
DATE_FORMAT(termStart,'%m') = $month
ORDER BY termStart
";
$found = mysql_query($select) or die(mysql_error());
exit;
Kommentar
-
hm, schätze mal, du arbeitest mit den demo-kalenderdaten (aus 2002) und bekommst deshalb eine fehlerhafte ausgabe ... kann das sein?
probiers mal bitte damit:
PHP-Code:<style type="text/css">
TD, TH {
FONT-FAMILY: Arial, Verdana, Trebuchet MS, Helvetica;
FONT-SIZE: 8pt;
FONT-WEIGHT: none;
COLOR: black;
BACKGROUND-COLOR: #FBFBFD;
}
.alt {BACKGROUND-COLOR: #E7E7F1;}
.basic {COLOR: white; BACKGROUND-COLOR: #606096;}
.top {COLOR: black; BACKGROUND-COLOR: #A3A3CB;}
.white {BACKGROUND-COLOR: #FFFFFF;}
.blank {BACKGROUND-COLOR: white;}
A:link, A:visited, A:active {
COLOR: #000020;
TEXT-DECORATION: underline;
}
A:hover {
COLOR: #FF4400;
}
</style>
<?
// Get todays date if we didn't get one
if (($year == "") || ($month == "") || ($day == "")) {
$year = date("Y");
$month = date("n");
$day = date("d");
}
include ("index-dateien/config.php");
mysql_connect("$dbserver", "$dbuser", "$dbpass") or die("could not connect"); // Connect zur DB
mysql_select_db("$dbname"); // Datenbank auswählen
$select = "SELECT DATE_FORMAT(termStart,'%d') as SqlTag, termSubject
FROM termine
WHERE
DATE_FORMAT(termStart,'%Y') = $year AND
DATE_FORMAT(termStart,'%m') = $month
ORDER BY termStart
";
$found = mysql_query($select);
while ($row = mysql_fetch_array($found)) {
$tag[] = $row[SqlTag];
$subj[] = $row[termSubject];
}
mysql_free_result($found);
$link_url = "";
$selector = 1;
$highlight = 1;
// Get info for Calendar generation
$daysmonth = date("t",mktime(0,0,0,$month,$day,$year));
$firstday = date("w",mktime(0,0,0,$month,1,$year));
$padmonth = date("m",mktime(0,0,0,$month,$day,$year));
$padday = date("d",mktime(0,0,0,$month,$day,$year));
// Customize according to $calendar_format
if ($firstday == 0) {
$firstday = 7;
}
$date = "$padday.$padmonth.$year";
$dayletter = array(1 => "Mo", 2 => "Di", 3 => "Mi", 4 => "Do", 5 => "Fr", 6 => "Sa", 7 => "So");
$daymod = 0;
?>
<table border="0" cellspacing="0" cellpadding="0" width="150">
<tr>
<td class=basic>
<table width="150" border="0" cellspacing="1" cellpadding="3">
<tr>
<th class=top colspan=7> <font color="#000000"><b><? echo $date;?></b></font></th>
</tr>
<tr>
<?
for($daynumber = 1; $daynumber < 8; $daynumber++) {
echo "<td><font size='1'>$dayletter[$daynumber]</font></td>";
}
?>
</tr>
<tr>
<?
for ($i = 1; $i < $daysmonth + $firstday + $daymod; $i++) {
$a = $i - $firstday + 1 - $daymod;
$day = $i - $firstday + 1 - $daymod;
if (strlen($a) == 1) {
$a = "0$a";
}
if (($i < $firstday) || ($a == "00")) {
$text = "";
$colour = "white";
$size = 10;
echo "<td class=white> </td>";
$k++;
} else {
$index = 0;
$title = "";
//++++++++++++++++++++++++++++++++++++++++++++++
if(isset($tag) && is_array($tag)) // gibbet überhaupt termine?
{
foreach ($tag as $padday) {
if (($padday == $a) && ($highlight)) {
$title = $subj[$index];
if (($i%7) == $daymod) {
$text = "$a";
$colour = "class=top";
break;
} else {
$text = "$a";
$colour = "class=top";
$size = 12;
break;
}
} else {
if (($i%7) == $daymod) {
$text = "$a";
$colour = "class=alt";
$size = 10;
} else {
$text = "$a";
$colour = "";
$size = 10;
}
}
$index++;
}
} // ende if
//++++++++++++++++++++++++++++++++++++++++++++++
if (eregi("class=top",$colour)) {
echo "<td $colour><font size='1'><a href='termindetail.php?year=$year&month=$month&day=$text' title='$title'>$text</a></font></td>"; // Hier der Link
} else {
echo "<td $colour><font size='1'>$text</font></td>";
}
}
if (($i%7) == 0) {
echo "</TR><TR>\n";
}
}
if (($i%7) != 1) {
echo "</TD>\n";
}
$colspan = 36 - $i;
if ($colspan < 1) {
$colspan = $colspan + 7;
}
for ($i = 0; $i < $colspan; $i++) {
echo "<td class=white> </td>";
}
echo "</tr><tr>";
// Print the selector
if ($selector) {
if ($month == 1) {
$pyear = $year - 1;
$pmonth = 12;
} else {
$pyear = $year;
$pmonth = $month - 1;
}
if ($month == 12) {
$nyear = $year + 1;
$nmonth = 1;
} else {
$nyear = $year;
$nmonth = $month + 1;
}
$year = date("Y");
$month = date("n");
$day = date("j");
echo "<TD colspan=7 class=white><center><FONT SIZE=-2><A HREF='$link_url?year=$pyear&month=$pmonth&day=1'>backw</A> | <A HREF='$link_url?year=$year&month=$month&day=$day'>today</A> | <A HREF='$link_url?year=$nyear&month=$nmonth&day=1'>forw</A></FONT></TD>\n";
}
?>
Kommentar
-
hi wurzel,
ich habe die demo dateien auf das neue datum geändert das war mir schon klar das die alten datums angaben nicht funktionieren würden. habe deine sache jetzt geladen und das geht die anzeige ist komplet und es kommt keine fehlermeldung beim kalender. nur wen ich jetzt auf die demo daten gehe zum beispiel 13.10 dan erscheint diese meldung.
select:SELECT * FROM termine WHERE DATE_FORMAT(termStart,'%Y') = 2003 AND DATE_FORMAT(termStart,'%m') = 10 AND DATE_FORMAT(termStart,'%d') = 13 ORDER BY termStart
Termin: 2003-10-13 11:00:00 bis 2003-10-14 12:00:00
Mittagessen
Vorbereitungen
Kommentar
-
die
- echo
- print_r
- <pre>
- exit
die du eingefügt hast, solltest du schon wieder aus dem code löschen.
speziell das exit
Kommentar
-
hi ,
die fehlermeldung kommt aber nicht vom kalenderscript sondern von dem termindetail.php :
PHP-Code:<?
mysql_connect("localhost", "web22", "mex510131061") or die("could not connect"); // Connect zur DB
mysql_select_db("usr_web22_9"); // Datenbank auswählen
$select = "SELECT * FROM termine WHERE
DATE_FORMAT(termStart,'%Y') = $_GET[year] AND
DATE_FORMAT(termStart,'%m') = $_GET[month] AND
DATE_FORMAT(termStart,'%d') = $_GET[day]
ORDER BY termStart
";
print "select:$select<br>"; // nur für alle Fälle
$found = mysql_query($select);
while ($row = mysql_fetch_array($found)) {
print "Termin: $row[termStart] bis $row[termEnd]<br>\n";
print " <b>$row[termSubject]</b><br>\n";
print " $row[termDetail]<br>\n";
}
mysql_free_result($found);
?>
wie kann man machen das der kalender auch wen keine termine sind das er ihn kompl. anzeigt
grußangie
Kommentar
Kommentar