Sabine: while Schleife in if Abfrage

Beitrag lesen

Hallo

ich werde die Fehlermeldung nicht los! Ich habe nun geschrieben:

$heutag=date("j");
$heumonat=date("n");
$heujahr=date("Y");

for ($i=0; $i < 7; $i++)
{
   switch($heumonat){

case 1: case 3: case 5: case 7 : case 8 : case 10:
     if($day > 32)
    {
      $day   = $heutag + $i - 31;
      $month = $heumonat+1;
      $njahr = $heujahr;
    }
    break;

case 2 :case 4 : case 6 : case 9 : case 11 :
       if($day > 31)
    {
      $day   = $heutag + $i - 30;
      $month = $heumonat + 1;
      $njahr = $heujahr;
    }
    break;

case 12 :
     if($day > 32)
    {
      $day   = $heutag + $i - 31;
      $month = 1;
      $njahr = $heujahr+1;
    }
    break;

default:
      $day    =$heutag+$i;
      $month  =$heumonat;
      $njahr  =$heujahr;
    };

echo "
    <h4>$day.$month.$njahr</h4>";

$sql="SELECT * FROM $dbtabelle WHERE tag=$day AND monat=$hmonth AND jahr=$njahr ORDER BY stunde,minute";
$satz = mysql_query($sql) or sql_error();

while($row = mysql_fetch_array($satz))
{
          extract($row);
            echo "
      <table>
      <tr valign='top'><td width=100>$stunde.$minute Uhr</td><td>
      $ort <br>
      $beschreibung
      </td></tr></table>  ";

};

};

und bekomme als Fehlermeldung

Warning: Missing argument 1 for sql_error() in C:\php\xampp\htdocs\Volkmar\termin\config.inc.php on line 22

MySQL Error 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND monat= AND jahr= ORDER BY stunde,minute' at line 1

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\php\xampp\htdocs\Volkmar\termin.php on line 63
..

Line 22 ist die Zeile nach dem switch-Befehl
line 63 wieder dort, wo die while Schleife beginnt!

Wo ist der Wurm?

Grüße,

Sabine