Les statistiques du Challenge


[insert_php]

$pagename = get_query_var(‘pagename’);
echo $pagename;

$mypilots=’CTRUGGY_PILOTES2015′;

$link= mysql_connect(“mysql5-5″,”rcsoeypirc94″,”fp6eR3X4”);
mysql_select_db(“rcsoeypirc94”, $link);

//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXML = ““;
$strCategories=”“;
$strDatasetPilotes2013=”“;
$strDatasetPilotes2014=”“;
$strDatasetPilotes2015=”“;
$strDatasetPilotesRC94=”“;
$strDatasetPilotesNonRC94=”“;

// Fetch all factory records
$strQuery = “SHOW COLUMNS IN CTRUGGY_PILOTES2015 LIKE ‘M\_%'”;
$result = mysql_query($strQuery) or die(mysql_error());

//Iterate through each factory
if ($result) {
while($ors = mysql_fetch_array($result)) {
//Now create a second query to get details for this factory
$strQuery2 = “SELECT COUNT(distinct ” . $ors[‘Field’] .”)-1 as TotalMois2015 FROM CTRUGGY_PILOTES2015″;
$result2 = mysql_query($strQuery2) or die(mysql_error());
$ors2 = mysql_fetch_array($result2);

$strQuery3 = “SELECT COUNT( NOM ) as PilotesRC94 FROM CTRUGGY_PILOTES2015 WHERE CLUB = ‘ROBOT CLUB 94’ AND ” . $ors[‘Field’] .” > ‘0’”;
$result3 = mysql_query($strQuery3) or die(mysql_error());
$ors3 = mysql_fetch_array($result3);

$strQuery4 = “SELECT COUNT( NOM ) as PilotesNonRC94 FROM CTRUGGY_PILOTES2015 WHERE CLUB <> ‘ROBOT CLUB 94’ AND ” . $ors[‘Field’] .” > ‘0’”;
$result4 = mysql_query($strQuery4) or die(mysql_error());
$ors4 = mysql_fetch_array($result4);

$strQuery5 = “SELECT COUNT(distinct ” . $ors[‘Field’] .”)-1 as TotalMois2013 FROM CTRUGGY_PILOTES2013″;
$result5 = mysql_query($strQuery5) or die(mysql_error());
$ors5 = mysql_fetch_array($result5);

$strQuery6 = “SELECT COUNT(distinct ” . $ors[‘Field’] .”)-1 as TotalMois2014 FROM CTRUGGY_PILOTES2014″;
$result6 = mysql_query($strQuery6) or die(mysql_error());
$ors6 = mysql_fetch_array($result6);

$strCategories .=”“;
$strDatasetPilotesRC94 .=”“;
$strDatasetPilotesNonRC94 .=”“;
$strDatasetPilotes2013 .=”“;
$strDatasetPilotes2014 .=”“;
$strDatasetPilotes2015 .=”“;

//free the resultset
mysql_free_result($result2);
mysql_free_result($result3);
mysql_free_result($result4);
mysql_free_result($result5);
mysql_free_result($result6);
}
// mysql_close($link);
}

//Finally, close element
$strCategories .= ““;
$strDatasetPilotes2013 .= ““;
$strDatasetPilotes2014 .= ““;
$strDatasetPilotes2015 .= ““;
$strDatasetPilotesRC94 .= ““;
$strDatasetPilotesNonRC94 .= ““;

// Building final strXML string
$strXML .= “{$strCategories}{$strDatasetPilotes2013}{$strDatasetPilotes2014}{$strDatasetPilotes2015}{$strDatasetPilotesRC94}{$strDatasetPilotesNonRC94}”;
$strXML .= ““;
echo $strXML;

//Create the chart – Pie 3D Chart with data from $strXML
echo renderChart(“https://www.rc94.com/FusionCharts/Charts/MSColumnLine3D.swf”, “”, $strXML, “NbPilotes2015”, 800, 500, false, false);

// Connect to the DB
// $link = connectToDB();

//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXMLChassis = ““;

// Fetch all factory records
//$strQueryChassis = “SELECT CHASSIS,CMODELE FROM `CTRUGGY_PILOTES2015` group BY CHASSIS,CMODELE”;
$strQueryChassis = “SELECT CHASSIS FROM `CTRUGGY_PILOTES2015` group BY CHASSIS”;
$resultChassis = mysql_query($strQueryChassis) or die(mysql_error());

//Iterate through each factory
if ($resultChassis) {
while($orsChassis = mysql_fetch_array($resultChassis)) {
//Now create a second query to get details for this factory
$strQueryChassis2 = “SELECT count(CHASSIS) as TotalChassis FROM `CTRUGGY_PILOTES2015` WHERE CHASSIS='” . $orsChassis[‘CHASSIS’] . “‘ ” ;

$resultChassis2 = mysql_query($strQueryChassis2) or die(mysql_error());

$orsChassis2 = mysql_fetch_array($resultChassis2);

//Generate
$strXMLChassis .= ““;
//free the resultset
mysql_free_result($resultChassis2);
}
// mysql_close($link);
}

//Finally, close element
$strXMLChassis .= “
“;

//Create the chart – Pie 3D Chart with data from $strXML
echo renderChart(“https://www.rc94.com/FusionCharts/Charts/Doughnut3D.swf”, “”, $strXMLChassis, “Repartitiondespilotesselonmodelechassis”, 800, 400, false, false);

// Connect to the DB
// $link = connectToDB();

//$strXML will be used to store the entire XML document generated
//Generate the chart element
$strXMLType = ““;

// Fetch all factory records
$strQueryType = “SELECT TYPE FROM `CTRUGGY_PILOTES2015` group BY TYPE”;
$resultType = mysql_query($strQueryType) or die(mysql_error());

//Iterate through each factory
if ($resultType) {
while($orsType = mysql_fetch_array($resultType)) {
//Now create a second query to get details for this factory
$strQueryType2 = “SELECT count(TYPE) as TotalType FROM `CTRUGGY_PILOTES2015` WHERE TYPE='” . $orsType[‘TYPE’] . “‘” ;

$resultType2 = mysql_query($strQueryType2) or die(mysql_error());

$orsType2 = mysql_fetch_array($resultType2);

//Generate
$strXMLType .= ““;
//free the resultset
mysql_free_result($resultType2);
}
// mysql_close($link);
}

//Finally, close element
$strXMLType .= “
“;

//Create the chart – Pie 3D Chart with data from $strXML
echo renderChart(“https://www.rc94.com/FusionCharts/Charts/Pie3D.swf”, “”, $strXMLType, “Repartitiondespilotesselonmotorisation”, 800, 500, false, false);

mysql_close();
[/insert_php]