es werden nur daten von der id 9 und 10 angezeigt

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • es werden nur daten von der id 9 und 10 angezeigt

    Hallo.
    ich habe einen Saisonspielplan in einer DB gespeichert.
    Nun möchte ich aber, dass immer das nächste Spiel angezeigt wird.
    Leider zeigt es mir erst das spiel der ID 9 an.

    mein code sieht so aus
    PHP Code:
    <?
    include "var.inc.php";

    $sql = "SELECT date, spiel, art, bemerkung, resultat, wo, id FROM vorrunde0708 
                  WHERE year(date) >= ".date("Y")." and month(date) >= ".date("m")." and day(date) > ".date("d")." and art='trainingsspiel'
                    or year(date) >= ".date("Y")." and month(date) >= ".date("m")." and day(date) > ".date("d")." and art='vorbereitungsturnier'
                        or year(date) >= ".date("Y")." and month(date) >= ".date("m")." and day(date) > ".date("d")." and art='meisterschaft'
                   order by date limit 1";
    $result = mysql_query($sql);
    $num = mysql_num_rows($result);

        $row = mysql_fetch_assoc($result);
            $date=date('d.m.Y', strtotime($row['date']));
        $day=date('D', strtotime($row['date']));
        $zeit=date('H:i', strtotime($row['date']));
        $spiel=$row['spiel'];
        $art=$row['art'];
            $wo=$row['wo'];
            
            $tag_array = array(
            "Mon" => "Montag",
            "Tue" => "Dienstag",
            "Wed" => "Mittwoch",
            "Thu" => "Donnerstag",
            "Fri" => "Freitag",
            "Sat" => "Samstag",
            "Sun" => "Sonntag");
            
            $tag = $tag_array["$day"];

    if($num>0)
    {
    echo"<table border=0 cellspacing=0 cellpadding=0>
        <tr>
            <td align=center width=200>N&auml;chstes Spiel<br>
            <br>
                ".$tag."&nbsp;".$date."<br>
                um&nbsp;".$zeit."<br>
                ".$spiel.$wo."<br>
                ".$art."</td>
        </tr>
    </table>";

    }
    ?>
    Was ist da falsch?
    bin leider nicht der PHP und mysql Profi hoffe aber doch auf Hilfe.

  • #2
    MySQL kann Daten vergleich, du musst nur beide ins selbe Format bringen.
    PHP Code:
        $row mysql_fetch_assoc($result); 
    Bist du dir sicher, dass du das nur einmal ausführen willst? Grundlagen lesen.
    Last edited by tontechniker; 24-07-2007, 16:34.
    Die Regeln | rtfm | register_globals | strings | SQL-Injections | [COLOR=silver][[/COLOR][COLOR=royalblue]–[/COLOR][COLOR=silver]][/COLOR]

    Comment


    • #3
      logische ausdrücke in der where-clause gehören geklammert.

      where (A and B and C) or (E and F and G) or (...

      und mysql_error() fehlt dir auch noch.

      übrigens, tut's ein
      Code:
      SELECT ... FROM ... WHERE `date` >= NOW()
      nicht auch schon?

      tontechniker: 1. es gibt nur ein "nächstes spiel", 2. www.das-dass.de
      Last edited by penizillin; 24-07-2007, 16:17.

      Comment


      • #4
        1. es gibt nur ein "nächstes spiel"
        Das hatte ich nicht bedacht
        Die Regeln | rtfm | register_globals | strings | SQL-Injections | [COLOR=silver][[/COLOR][COLOR=royalblue]–[/COLOR][COLOR=silver]][/COLOR]

        Comment

        Working...
        X