Jump to content

statistics


M-Queiroz

Recommended Posts

  • 2 weeks later...

;) 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 />";
}

?>

Link to comment
Share on other sites

  • 4 months later...

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.

Link to comment
Share on other sites

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  :'(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...