Announcement

Collapse
No announcement yet.

Datenübergabe

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

  • Datenübergabe

    Hallo,

    habe nachfolgende Script für meine Bedürfnisse umgewandelt.
    Leider habe ich aber darin einen Fehler.
    Ich bekomme immer nur den letzten Eintrag aus der Datenbank

    Was muss ich ändern um die letzten 25 Einträge zu erhalten.

    PHP Code:
    <?php
    /*
     * You may not remove this header!
     *
     * -----------------------------------------------------------------------------------------------------------------------
     * 'pilot_roster.php' script code was made by Paulo Correia - FSAcars Team (©)2003
     * It's part of the FSAcars 2 for VA's package 
     *
     * This script assumes that the VA has PHP support and a MySQL database on it's site
     * ----------------------------------------------------------------------------------------------------------------------
     *
     * FSACARS is distributed freely.
     *
     * Disclaimer
     * Although this product has been intensively tested, the authors accepts no responsibility for any damages caused by the use or misuse of this
     * software. This software is distributed 'as is' with no warranty expressed or implied. The authors will not be responsible for any losses incurred, either directly or indirectly, by the use of this software.
     * Use this software entirely at your own risk. If you do not agree to these terms then you must not use this software.
     *
     * Copyright
     * This software is a copyrighted program. AIBridge is a copyright of José Oliveira. FSACARS coding is a copyright of José Oliveira. FSACARS concept was idealized by Pedro Sousa.
     * It is protected by international copyright laws.
     */
     
    /* Constants */
    @define ("MYSQL_CONNECT_INCLUDE""connect_db.php");        // MySQL database connection (a sample file is included)

     
    /* Database connection */
    include(MYSQL_CONNECT_INCLUDE);

    /* Select all pilots */
    $query "SELECT * FROM reports ORDER BY pilot_id =032 ASC";
    $result mysql_query($query);

    /* Determine the number of pilots */
    $numbers mysql_numrows($result);

    if (
    $numbers 0) {
        
    /* Print roster header 
           Change this HTML to fit your webpage layout */
        
    print "<table>";
        print 
    "<tr>";
        print 
    "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Datum</b></font></td>";
        print 
    "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Callsign</b></font></td>";
        print 
    "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Start</b></font></td>";
        print 
    "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Landung</b></font></td>";
        print 
    "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Flugzeit</b></font></td>";
        print 
    "</tr>";
        
        
    /* Get pilots info */
        
    for ($i=0$i<$numbers$i++) {
                 
    $date mysql_result($result,$i,"date");
                 
    $callsign mysql_result($result,$i"callsign");
                 
    $origin_id mysql_result($result,$i"origin_id");
                 
    $destination_id mysql_result($result,$i"destination_id");
                 
    $duration mysql_result($result,$i"duration");
            
            
                 
            }
                 
                 
    /* Display roster entries */
                 
    print "<tr>";
                 print 
    "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$date</font></td>";
                 print 
    "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$callsign</font></td>";
                 print 
    "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$origin_id</font></td>";
                 print 
    "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$destination_id</font></td>";
                 print 
    "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$duration</font></td>";
                 print 
    "</tr>";
        }
        
        print 
    "</table>";


    /* Print table footer */
    print "<table>";
    print 
    "<tr><td><font face=Arial size=1 color=gray>Powered by FSACARS for VA's - http://www.satavirtual.org/fsacars/</font></td></tr>";
    print 
    "</table>";

    /* Close the database connection */
    mysql_close();
    ?>

  • #2
    die Klammer der for Schleife sitzt falsch
    Christian

    Comment


    • #3
      Hallo Christian,

      danke für deine schnelle Hilfe.
      Stehe aber komplett auf dem Schlauch. Kannst du mir den Ersatz dafür, bitte, schreiben.
      Danke

      Beispiel:
      http://www.hamburg-air.de/fsacars_log/test.php
      Zuletzt editiert von Ghost66; 25.07.2008, 15:59.

      Comment


      • #4
        Stehe aber komplett auf dem Schlauch. Kannst du mir den Ersatz dafür, bitte, schreiben.
        ?????

        Du bist nicht in der Lage das Ende der for-Schleife einfach zu versetzen?
        Von

        $destination_id = mysql_result($result,$i, "destination_id");
        $duration = mysql_result($result,$i, "duration");



        }


        nach

        print "</tr>";
        ->> hier her }

        ?????

        Wie sollte ich Ersatz schreiben....ich habe deine DB nicht und kenne den Aufbau nicht
        Christian

        Comment


        • #5
          Hallo Christian,

          leider muss ich gestehen, dass PHP für mich vollkommenes Neuland ist und ich mich gerade erst daran versuche.

          Leider hat das verschieben der Klammer zu keinem Erfolg geführt. Ich bekomme immer noch den letzten Eintrag angezeigt.
          Nach meinem Verständnis müsste der Fehler also in der Schleife liegen.

          Wenn ich den SQL Code in der Tabelle eingebe, werden mir ordnungsgemäß alle Einträge angezeigt.

          Die orginalen Codex und die dazugehörige Datenbankstruktur findest du unter
          http://www.satavirtual.org/fsacars/downloads.html

          Würde mich freuen, wenn du mir helfen könntest. "DANKE"

          PHP Code:
          <?php
          /*
           * You may not remove this header!
           *
           * -----------------------------------------------------------------------------------------------------------------------
           * 'pilot_roster.php' script code was made by Paulo Correia - FSAcars Team (©)2003
           * It's part of the FSAcars 2 for VA's package 
           *
           * This script assumes that the VA has PHP support and a MySQL database on it's site
           * ----------------------------------------------------------------------------------------------------------------------
           *
           * FSACARS is distributed freely.
           *
           * Disclaimer
           * Although this product has been intensively tested, the authors accepts no responsibility for any damages caused by the use or misuse of this
           * software. This software is distributed 'as is' with no warranty expressed or implied. The authors will not be responsible for any losses incurred, either directly or indirectly, by the use of this software.
           * Use this software entirely at your own risk. If you do not agree to these terms then you must not use this software.
           *
           * Copyright
           * This software is a copyrighted program. AIBridge is a copyright of José Oliveira. FSACARS coding is a copyright of José Oliveira. FSACARS concept was idealized by Pedro Sousa.
           * It is protected by international copyright laws.
           */
           
          /* Constants */
          @define ("MYSQL_CONNECT_INCLUDE""connect_db.php");        // MySQL database connection (a sample file is included)

           
          /* Database connection */
          include(MYSQL_CONNECT_INCLUDE);

          /* Select all pilots */
          $query "SELECT * FROM `reports` WHERE `pilot_id`=32 order by`date`asc";
          $result mysql_query($query);

          /* Determine the number of pilots */
          $numbers mysql_numrows($result);

          if (
          $numbers 0) {
              
          /* Print roster header 
                 Change this HTML to fit your webpage layout */
              
          print "<table>";
              print 
          "<tr>";
              print 
          "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Datum</b></font></td>";
              print 
          "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Callsign</b></font></td>";
              print 
          "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Start</b></font></td>";
              print 
          "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Landung</b></font></td>";
              print 
          "<td bgcolor=#000080 width=73 height=12 align=left><font face=Arial color=#FFFFFF size=2><b>Flugzeit</b></font></td>";
              print 
          "</tr>";
              
              
          /* Get pilots info */
              
          for ($i=0$i<$numbers$i++) {
                       
          $date mysql_result($result,$i,"date");
                       
          $callsign mysql_result($result,$i"callsign");
                       
          $origin_id mysql_result($result,$i"origin_id");
                       
          $destination_id mysql_result($result,$i"destination_id");
                       
          $duration mysql_result($result,$i"duration");
                  
                  
                       
                  
                       
                       
          /* Display roster entries */
                       
          print "<tr>";}
                       print 
          "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$date</font></td>";
                       print 
          "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$callsign</font></td>";
                       print 
          "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$origin_id</font></td>";
                       print 
          "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$destination_id</font></td>";
                       print 
          "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$duration</font></td>";
                       print 
          "</tr>";
              
              }
              print 
          "</table>";


          /* Print table footer */
          print "<table>";
          print 
          "<tr><td><font face=Arial size=1 color=gray>Powered by FSACARS for VA's - http://www.satavirtual.org/fsacars/</font></td></tr>";
          print 
          "</table>";

          /* Close the database connection */
          mysql_close();
          ?>

          Comment


          • #6
            An die falsche Stelle geschoben

            /* Display roster entries */
            print "<tr>"; >>>>>>>Hier weg
            print "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$date</font></td>";
            print "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$callsign</font></td>";
            print "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$origin_id</font></td>";
            print "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$destination_id</font></td>";
            print "<td width=73 height=12 align=left><font face=Arial size=2 color=#000080>$duration</font></td>";
            print "</tr>";
            } ->>>>>> hier hin


            Es ist doch einfach:

            SQL und weiteres um die Daten zu holen

            Tabellenkopf erstellen

            Dann eine Schleife, die
            - die Daten aus dem SQL holt
            - und jeweils eine Tabellenreihe erzeugt

            DAHINTER muss die Schleife zu gemacht werden

            Außerdem ist ein Copyright auf dem Code.......man fragt sich warum......
            Christian

            Comment


            • #7
              Hallo Christian,

              danke für deine super Hilfe.
              Nach Kauf eines Buches habe ich mein Script etwas umgestellt.
              Würde aber gern den Ausdruck etwas verändern.
              zb. Spaltenbreiten festlegen und Schriftgöße ändern.

              Gibt es eine Möglichkeit die Farbe des Zeilenhintergrundes zwischen zwei Farben zu wechseln?


              PHP Code:

              <?php
              include("connect_db1.php");
              $verbindung=mysql_connect($dbhost,$dbuser,$dbpasswd);
              $sqlbefehl="SELECT * FROM `reports` WHERE `pilot_id`=32 order by `date`desc LIMIT 0, 25 ";
              $abfrage2=mysql_db_query($db,$sqlbefehl,$verbindung);


              echo
              "<table border=0>
              <tr>
              <td>Datum</td>
              <td>Start</td>
              <td>Landung</td>
              <td>Flugzeit</td>
              </tr>"
              ;

              while(list(
              $report_id,$pilot_id,$date,$time,$callsign,$origin_id,$destination_id,$registration,$equipment,$duration,$fuel,$distance,$fsacars_rep_url)=mysql_fetch_array($abfrage2))
              {
              echo
              "<tr>
              <td>
              $date</tr>
              <td>
              $origin_id</td>
              <td>
              $destination_id</td>
              <td>
              $duration</td>
              </tr>"
              ;
              }
              echo
              "</table>";

              mysql_close($verbindung);
              ?>
              Danke dir schon mal für deine Hilfe

              Comment


              • #8
                Gibt es eine Möglichkeit die Farbe des Zeilenhintergrundes zwischen zwei Farben zu wechseln?
                Ja, wie das geht -> siehe den entfernten Teil des Kopfes zuzüglich einer Prüfung die je nach gerade oder ungerade einen anderen Farbwert setzt
                Christian

                Comment

                Working...
                X