Du brauchst dir nur die PHP stellen raus Kopieren und in deinem Editor wieder einfügen und dann hast du schon das Kalender-Script.
@hand Dein Kalender-Script
Einklappen
X
-
*winks*
Gilbert
------------------------------------------------
Hilfe für eine Vielzahl von Problemen!!!
http://www.1st-rootserver.de/
-
sorry wen ich mich falsch ausgedrückt habe, ich meine die terminedetail.php, wie gebe ich hier die richtigen einträge aus, also wie muß der mysqlquery aufgebaut sein?
nochma sorry wenn was nicht verstänlich ist.
cuu<<<-----newbie na und???
Kommentar
-
Eine Möglichkeit wäre ...
PHP-Code:<?
// ich bin termindetail.php
mysql_connect("localhost", "", "") or die("could not connect"); // Connect zur DB
mysql_select_db("test"); // Datenbank auswählen
$select = "SELECT * FROM termine
WHERE
DATE_FORMAT(termStart,'%Y') = $year AND
DATE_FORMAT(termStart,'%m') = $month AND
DATE_FORMAT(termStart,'%d') = $day
ORDER BY termStart
";
$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);
?>
Kommentar
-
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\...... on line 13
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\.....on line 19
hmmw eiter bin ich nicht gekommen, die daten zur db sind korekt....
danke aber erstmal<<<-----newbie na und???
Kommentar
-
Kontrolliere bitte, ob Du die richtige Datenbank auswählst in der Zeile:
mysql_select_db("test"); // Datenbank auswählen
Wenn die DB falsch ist kommt es zu den von Dir beschriebenen Fehlern. Oder ergänze diese Zeile mit einem OR-Statement:
mysql_select_db("test") or die("Sorry select der db ist nicht gelungen"); // Datenbank auswählen
Kommentar
-
nene es ist alles richtig, und er fehler tritt nur in der detail seite auf, ich hab die daten 1zu1 von der kalendermainseite kopiert.....
PHP-Code:WHERE
DATE_FORMAT(termStart,'%Y') = $year AND
DATE_FORMAT(termStart,'%m') = $month AND
DATE_FORMAT(termStart,'%d') = $day
ORDER BY termStart";
cu<<<-----newbie na und???
Kommentar
-
Dann sind die Variablen $year, $month und $day nicht gesetzt.
Probier es mal so
PHP-Code:<?
mysql_connect("localhost", "", "") or die("could not connect"); // Connect zur DB
mysql_select_db("test") or die("db falsch"); // 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);
?>
Kommentar
-
schade...
select:SELECT * FROM termine WHERE DATE_FORMAT(termStart,'%Y') = AND DATE_FORMAT(termStart,'%m') = AND DATE_FORMAT(termStart,'%d') = ORDER BY termStart
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\appserv\www\schulegreen\html\tmpd1c8m5j8jb.php on line 14
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\appserv\www\schulegreen\html\tmpd1c8m5j8jb.php on line 20
...danke dir<<<-----newbie na und???
Kommentar
-
Hast den Fehler jetzt gefunden? Mit welchen Variablen rufst Du "termindetail.php" auf?
Vielleicht mit $_REQUEST[year], ...
PHP-Code:<?
mysql_connect("localhost", "", "") or die("could not connect"); // Connect zur DB
mysql_select_db("test") or die("db falsch"); // Datenbank auswählen
if (!isset($_REQUEST[year]) || !isset($_REQUEST[month]) || !isset($_REQUEST[day])) {
die ("Variablen sind nicht gesetzt");
}
if (strlen($_REQUEST[month]) == 1) {
$_REQUEST[month] = "0".$_REQUEST[month];
}
$varDat = "$_REQUEST[year]"."-"."$_REQUEST[month]"."-"."$_REQUEST[day]";
$select = "SELECT * FROM termine WHERE DATE_FORMAT(termStart,'%Y-%m-%d') = '$varDat' ORDER BY termStart";
$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);
?>
Kommentar
-
aus den scirpt von hand
hmm hatte n fehler in line 101
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 = "";
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++;
}
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";
}
?>
/** und die fehler zeile **/
foreach ($tag as $padday) {
Kommentar
Kommentar