Uso il seguente calendario che crea un collegamento ipertestuale ai giorni in cui sono presenti dei record che vengono estratti tramite la funzione evento...ma non funziona
Qualcuno sa dirmi dove sta il problema?? grazie
Asia
Codice PHP:
<?php
include_once("include/config.php");
function evento($var){
include_once("include/config.php");
$today=date("Y-m-d");
$select="SELECT * FROM post";
$recordset=mysql_query($select);
if (!$recordset){
echo("Errore!!!!");
}
for ($w=0; $w<=$var;$w++){
$record=mysql_fetch_array($recordset);
}
return $record["date"];
}
$giorno = Array("L","M","M","G","V","S","D");
$nomemese = Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno", "Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre");
$y=$_REQUEST['y'];
if ($y=="") $y=date("Y");
$m=$_REQUEST['m'];
if ($m=="") $m=date("m");
$anno=$y; $mese=$m;
if ($mese==1) $back="y=".($anno-1)."&m=12";
else $back="y=".$anno."&m=".($mese-1);
if ($mese==12) $next="y=".($anno+1)."&m=1";
else $next="y=".$anno."&m=".($mese+1);
print " <div align='center'>";
print "<a href=\"?".$back."\">«</a> ";
print "[b]".$nomemese[$m-1]." ".$y."[/b] ";
print "<a href=\"?".$next."\">»</a>";
print " </div>";
$n_date = $i.$m.$y;
print "<table align=\"center\">";
print " <tr>";
for ($i=0;$i<7;$i++){
print " <th>".$giorno[$i]."</th>";
}
print " </tr>";
$primo=mktime(0,0,0,$m,1,$y);
$delta=date("w",$primo)-1;
if($delta == -1) $delta = 6;
print " <tr>\n";
for ($i=0;$i<$delta;$i++){
print " <td></td>";
}
$num= 0;
for ($i=1;$i<=date("t",$primo);$i++){
if ($i <=9){
$i ="0".$i;
} else {
$i = $i;
}
$event=evento($num);
$day = "$y-$m-$i";
if (($i+$delta)%7==1) print " <tr>"; //inizio riga
if($day == $event) {
print "<td><a href=\"blog.php?date=$day\">".$i."</a></td>"; //1
} else print " <td>".$i."</td>";
if (($i+$delta)%7==0) print " </tr>"; //chiusura riga
$num++;
}
print "</table>\n";
?>