M-Queiroz Posted August 14, 2009 Report Share Posted August 14, 2009 Hello auguem have a php or html code of statistics for the total value of the home riders, acrafit total, total hours, total flights, all logs, Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted August 15, 2009 Administrators Report Share Posted August 15, 2009 Use the StatsData::<function name> functions: http://docs.phpvms.net/api Quote Link to comment Share on other sites More sharing options...
M-Queiroz Posted August 24, 2009 Author Report Share Posted August 24, 2009 heup top 10 para todos <?php //set local variables $dbhost = "localhost"; $dbuser = "xxxxxx"; $dbpass = "xxxxxx"; $dbname = "xxxxxx"; //connect $db = mysql_pconnect($dbhost,$dbuser,$dbpass); mysql_select_db("$dbname",$db); // tex de MySQL Connection echo "<br />"; //base de dados echo "<br />"; //base de dados // Total de Aeroportos $query = "SELECT count(id) FROM phpvms_airports "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de Aeroportos ". $row['count(id)']; echo "<br />"; } // Total de Destinos $query = "SELECT count(id) FROM phpvms_schedules "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de Destinos ". $row['count(id)']; echo "<br />"; } // Total de Aerolinhas $query = "SELECT count(id) FROM phpvms_airlines "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de Aerolinhas ". $row['count(id)']; echo "<br />"; } // Total de Aeronaves $query = "SELECT count(enabled) FROM phpvms_aircraft "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de Aeronaves ". $row['count(enabled)']; echo "<br />"; } // Total de Pilotos $query = "SELECT SUM(confirmed) FROM phpvms_pilots "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de Pilotos ". $row['SUM(confirmed)']; echo "<br />"; } // Total de Voos $query = "SELECT count(pirepid) FROM phpvms_pireps "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de Voos ". $row['count(pirepid)']; echo "<br />"; } // Total de MILHAS $query = "SELECT sum(distance) FROM phpvms_pireps "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de Milhas ". $row['sum(distance)']; echo "<br />"; } // Total de horas $query = "SELECT SUM(flighttime) FROM phpvms_pireps "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de Horas ". $row['SUM(flighttime)']; echo "<br />"; } // Total de fuel $query = "SELECT SUM(fuelprice) FROM phpvms_pireps "; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Total de fuel ". $row['SUM(fuelprice)']; echo "<br />"; } // Piloto com Mais Hooras $query = "SELECT firstname, lastname, totalhours FROM phpvms_pilots WHERE totalhours = (select max(totalhours) FROM phpvms_pilots limit 10)"; $sql = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($sql)){ echo "TOP". $row['firstname']. " ". $row['lastname']. ": ". $row['totalhours']; echo "<br />"; echo "<br />"; } // Total pilotos que mais voou no mes por horas $query = "select p.code, p.pilotid, firstname, lastname, sum(r.flighttime) ,count(r.pirepid), submitdate, r.pilotid from phpvms_pilots p left join phpvms_pireps r on p.pilotid = r.pilotid right join phpvms_aircraft a on a.id = r.aircraft WHERE year(r.submitdate) = year(now()) and month(r.submitdate) = month(now()) GROUP BY p.pilotid ORDER BY sum(r.flighttime) DESC LIMIT 0,10"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "Piloto: ". $row['firstname']. " ". $row['lastname']; echo "<br />"; echo " ID: ". $row['code']. "0". $row['pilotid']; echo "<br />"; echo "Total de Voos: ". $row['count(r.pirepid)']; echo "<br />"; echo "Horas: " . $row['sum(r.flighttime)'] ; echo "<br />"; echo "<br />"; } ?> Quote Link to comment Share on other sites More sharing options...
g3r84 Posted January 16, 2010 Report Share Posted January 16, 2010 Hi there been trying to make some statistics to apear on the side bar of my site using the StatsData::<function name> but keep getting this error Parse error: parse error, expecting `')'' in C:Archivos de programaApache Software FoundationApache2.2htdocsphpvmslibskinsvnefooter.tpl on line 9 This is my php code <?php $pilotstotal = StatsData::PilotCount ([ $airline_code = '']); $aircrafttotal = StatsData::TotalAircraftInFleet ([ $airline_code = '']); $flightstotal = StatsData::TotalFlights ([ $airline_code = '']); $distancetotal = StasData::TotalMilesFlown ([ $airline_code = '']); $paxtotal = StatsData::TotalPaxCarried ([ $airline_code = '']); $routestotal = StatsData::TotalSchedules ([ $airline_code = '']); $hourstotal = StatsData::TotalHours (); ?> Tried puting the Va code but it gives the same error Ps.: Sorry to revive this old post didn't wanted to open a new one for this. Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted January 16, 2010 Moderators Report Share Posted January 16, 2010 Is there any need to specify a connection to the database? Is it not possible just to use Nabeels functions Quote Link to comment Share on other sites More sharing options...
g3r84 Posted January 16, 2010 Report Share Posted January 16, 2010 Is there any need to specify a connection to the database? Is it not possible just to use Nabeels functions I think not i checked another part of the code that use that same StatsData::<function name> and it doesn't use a connection to the data base <h3>Users Online</h3> <br /> <?php $usersonline = StatsData::UsersOnline(); $guestsonline = StatsData::GuestsOnline(); ?> <h4 class="style6">Pilots Online </h4> <p class="txt-red10"> Have <?php echo count($usersonline);?> Pilots Online. <?php foreach($usersonline as $pilot) { echo "<p>"; echo '<img src="'.Countries::getCountryImage($pilot->location).'" alt="'.Countries::getCountryName($pilot->location).'" />'; echo " {$pilot->firstname} {$pilot->lastname}<br />"; echo "</p>"; } ?><br /> <h4 class="style3">Guests Online </h4> <p class="txt-red10"> Have <?php echo count($guestsonline);?> Guests Online. but i can't seem to find the right way to use the statsdata :'( Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 17, 2010 Administrators Report Share Posted January 17, 2010 You're using them wrong: $pilots_total = StatsData::PilotCount (); //or $pilots_total = StatsData::PilotCount ('VMS'); Same thing for the rest Quote Link to comment Share on other sites More sharing options...
g3r84 Posted January 17, 2010 Report Share Posted January 17, 2010 Thanks Nabeel i knew it was my bad wasn´t clear for me how to use them now it works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.