Fixed month tables generation
authorshort <>
Thu, 16 Aug 2001 13:07:22 +0000 (13:07 +0000)
committershort <>
Thu, 16 Aug 2001 13:07:22 +0000 (13:07 +0000)
index.php

index 87a9545..b9b95d3 100644 (file)
--- a/index.php
+++ b/index.php
@@ -32,7 +32,6 @@ db_connect();
 $result=db_query("select year,month,month_last from $tb_obsah order by year,month");
 $split=6;
 $year=0;
-$month=-$split;
 $fin_split="";
 $fin_year="";
 while ($row=mysql_fetch_array($result)) {
@@ -46,13 +45,14 @@ while ($row=mysql_fetch_array($result)) {
                print("<table border=\"0\" width=\"100%\"><tr><td align=\"center\"><table border=\"1\" cellpadding=\"5\">\n"
                                ."<tr><th colspan=\"$split\">Roèník $year (<a href=\"obsah.php?year=$year\">obsahy èísel</a>)</th></tr>\n"
                                );
-               $fin_year="</table></td></tr></table>\n";
-               $month=-$split;
+               $fin_year="</table></td></tr></table><br />\n";
+               $month=-1;
+               $floor=-1;
                }
-       if ($month && floor($row["month"]/$split)!=floor($month/$split)) {
+       while ($floor<floor($row["month"]/$split)) {
                print($fin_split."<tr>");
                $fin_split="</tr>";
-               $month=$row["month"]-($row["month"]%$split)-1;
+               $floor++;
                }
        while ($month+1<$row["month"]) {
                print("<td></td>");