[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
 

[PHP] Event/kalender



Hej

Jeg er i gang med et primitivt kalender system. Jeg har en tabel med indtastninger. Der sorteres efter feltet 'start' der indeholder en dato i timestamp format, og konverterer det til noget brugbart v.h.a. af getdate(). Jeg skal så have skrevet en table ud til brugeren der ser således ud:

<table>
<tr><td colspan="2">Måned</td></tr>
<tr><td>Dato</td><td>Event<br>Event<br>Event...</td></tr>
<tr><td>Dato2</td><td>Event<br>Event<br>Event...</td></tr>
</table>

Spørgsmålet er nu hvorledes det nemmest gøres. Selvfølgelig noget lignende dette:

$category = $_GET['category'];
if (!empty($category)){
$cat_name = translate($category);
?>
<table width="500" border="1" class="topmenu">
<tr><td colspan="2" align="center">
<h1><?=$cat_name;?>events</h1>
</td></tr>
<?
$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());
while ($data = mysql_fetch_array($result)){
$time = $data['start'];
$time = getdate($time);
$month = $time['mon'];
$date = $time['mday'];
if ($old_month != $month){
echo "<tr><td align=\"center\" colspan=\"2\"><div class=\"h2\">".transmonth($month)."</div></td></tr>";
}
$old_month = $month;
if ($old_date != $date){
echo "<tr><td align=\"center\" width=\"15\">$date</td><td>";
}
$title = $data['title'];
$id = $data['ID'];
echo "<a href=\"index.php?action=show&id=$id\" title=\"$title\">$title</a><br>";


Men når så jeg skal have lukket mit <td> tag, er jeg jo nødt til at vide at det er den sidste post i den dato... hvorledes gøre det?
---
Arkanoid


 
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] *