mam skrypcik, co mi pobiera dane z tebeli, oblicza średnią z otrzymanych wartości - wszystko to dladanych z roku 2008. W związku z nadejściem nowego, chcę uaktualnić skrypt, żeby robił to samo dla 2009. W osobnym pliku wszystko działa świetnie, ale chciałbym, żeby wynik dla 2009 był wyświetlany w kolumnie obok 2008 - i z tym do Was przychodzę. Dodatkowo, skrypt ma wyświetlać dane w odpowiednim kolorze, dla każdego progu (pętelka). Zaznaczam, że podstawą tego skryptu jest skrypt darmowy, nie mojego autorstwa, natomiast ja dokonałem tylko jego modyfikacji dla swoich potrzeb (żeby nie było, że coś sobie przywłaszczam). Próbowałem inkludować plik dla 2009 ale niestety dzieją sie... Po przerobieniu kwerendy z datami dla 2009, pokazuje poprawnie do pierwszego spełnionego warunku, potem już tylko powiela wynik (bez sensu) i ginie funkcja kolorowania progów. Any ideas?
Oto skrypt działający dla 2008 roku:
<?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 pilots where status = '1' ORDER BY pilot_num ASC"; /* Determine the number of pilots */ if ($number > 0) { /* Print roster header */ print "<table class= 'sample' bgcolor=FFFFFF width=180 border=1 'collapse' style= border-collapse: collapse >"; print "<td bgcolor=FFFFFF width=40 height=18 align=center><font face=Arial color=#FFFAF0 size=2><b>Pilot</b></font></td>"; print "<td bgcolor=FFFFFF width=40 height=18 align=center><font face=Arial color=#FFFAF0 size=2><b>Lotów</b></font></td>"; print "<td bgcolor=FFFFFF width=100 height=18 align=center><font face=Arial color=#FFFAF0 size=2><b>Poziom</b></font></td>"; /* Get pilots info */ for ($i=0; $i<$number; $i++) { /* Calculate flight hours */ $query_hours = "SELECT sec_to_time(sum(time_to_sec(t2.duration))) AS duration_sum FROM pilots t1, reports t2 WHERE t1.pilot_id=$id AND t1.pilot_id=t2.pilot_id"; // Łączna liczba $query_count = "SELECT * FROM `reports` WHERE pilot_id = $id and date > '2007-12-31' AND (zaliczenie = 'A' OR zaliczenie= 'B' OR zaliczenie = 'C') " ; if ($value < 1) { } else { $query_count2 = "SELECT * FROM `reports` WHERE pilot_id = $id and zaliczenie = 'A' and date > '2007-12-31' " ; //Loty warunkowe $query_count3 = "SELECT * FROM `reports` WHERE pilot_id = $id and zaliczenie = 'B' and date > '2007-12-31' " ; // Obliczanie skutecznosci $skutecznosc = ($value2 * 100)/ $value ; } } /* Print roster header */ if ($value < 1) { print "<td width=16% height=18 align=center><font face=Arial size=2 color=#FF0000 >$value</font></td>"; } else if ($skutecznosc_zaokraglona < 65) { print "<td width=16% height=18 align=center><font face=Arial size=2 color=#FF0000 >$value</font></td>"; print "<td width=20% height=18 align=left><font face=Arial size=2 color=#FF0000 >$skutecznosc_zaokraglona %</font></td>"; } else if ($skutecznosc_zaokraglona < 75) { print "<td width=16% height=18 align=center><font face=Arial size=2 color=#FFD700 >$value</font></td>"; print "<td width=20% height=18 align=left><font face=Arial size=2 color=#FFD700 >$skutecznosc_zaokraglona %</font></td>"; } else if ($skutecznosc_zaokraglona < 90) { print "<td width=16% height=18 align=center><font face=Arial size=2 color=#DAA520 >$value</font></td>"; print "<td width=20% height=18 align=left><font face=Arial size=2 color=#DAA520 >$skutecznosc_zaokraglona %</font></td>"; } else if ($skutecznosc_zaokraglona < 110) { print "<td width=16% height=18 align=center><font face=Arial size=2 color=#00FF00 >$value</font></td>"; print "<td width=20% height=18 align=left><font face=Arial size=2 color=#00FF00 >$skutecznosc_zaokraglona %</font></td>"; } } } /* Close the database connection */ php?>