[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [PHP] Event/kalender



Arkanoid wrote:
Hmm....Hvis nu den også skal inddeles i år... altså først år, så måned, og så dato/events, hvad gør jeg så... har prøvet mig lidt frem med at tilføje en key til $events[] men jeg ender ude i noget rod hver gang.

Her er den nuværende kode:

$curtime = time();
$sql = "SELECT * FROM events WHERE category='".$category."' AND start >= $curtime ORDER BY start ASC";
$result = mysql_query($sql) or die("Fejl: ".mysql_error());
$events=array();
while($data=mysql_fetch_assoc($result)){
$time = getdate($data['start']);
$events[$time['mon']][$time['mday']][]=$data;

$events[$time['year']][$time['mon']][$time['mday']][]=$data;


}
?>
<br>
<table width="500" border="1" class="topmenu" align="center">
<tr><td colspan="2" align="center">
<h1><?=$cat_name;?>events</h1>
</td></tr>
<?

foreach($events as $year => $yearevents){ echo "<tr><td colspan='2'>$year</td></tr>";

foreach($events as $month => $monthevents){

foreach($yearevents as $month => $monthevents){


echo '<tr><td align="center" colspan="2"><div class="h2">'.month($month).'</div></td></tr>';
foreach($monthevents as $date => $dateevents){
echo '<tr><td align="center" width="5"><div class=\"form\">'.$date.'</div></td><td>';
foreach($dateevents as $data){
echo '<a href="index.php?action=show&id=';
echo $data['ID']. '" title="'. $data['title'] .'">';
echo $data['title'] . '</a><br>';
}
echo '</td></tr>';
}
}

}


echo '</table>';

Håbe du kan hjælpe.

Det skulle vist være det hele.


Med venlig hilsen

Ole

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *