Comparaison journalière et mensuelle groupés par années

Mettez un lien vers vos créations.

Modérateurs : jturlier, Météo Villarzel

muchistic
Messages : 142
Enregistré le : 17 févr. 2014, 20:20
Localisation : Canejan (33)
Contact :

Re: Comparaison journalière et mensuelle groupés par années

Message par muchistic » 13 sept. 2018, 08:41

Bonjour Pierre André

Merci pour ton aide, je vais essayé tout ça ce matin en prenant les précautions d'usage :D .
Après, si je modifie mysql par mysqli dans les fichiers des graphiques, faut t'il que j'apporte des modifications dans le fichier "db_ro_details_gw.php" tel qu'il est ou alors mettre un fichier tel que "mysqli_connect.php" :?:

Bonne journée
Dominique

ps : je n'avais jamais essayé cette méthode et c'est vrais que c'est beaucoup plus rapide et tu n'oublie aucune modif a faire, par contre ça ne résoud pas le soucis, tout passer en mysqli rend mes graphiques invisibles : http://mobile.meteo-canejan.fr/isto-jours-mois.php

j'attend la réponse pour l fichier de connexion : "db_ro_details_gw.php"
https://www.meteo-canejan.fr/

ma config : VP2sql , Weaterlink 6.03 , NOAAtable, minimaxibis (sonde agricole), Windows 10 .

muchistic
Messages : 142
Enregistré le : 17 févr. 2014, 20:20
Localisation : Canejan (33)
Contact :

Re: Comparaison journalière et mensuelle groupés par années

Message par muchistic » 13 sept. 2018, 19:52

finalement ça fonctionne en mysqli , j'ai changé un peu le code également, j'en ai supprimé (trop peut être) et rajouté .
c'est visible à cette adresse http://mobile.meteo-canejan.fr/isto-jours-mois.php
le code du fichier : historicDayTemp_modif.php

Dominique

Code : Tout sélectionner

<?php
// Standard Source view option check
function check_sourceview () {
    global $SITE;
    if (isset($_GET['view']) && $_GET['view'] == 'sce') {
        $filenameReal = __FILE__;
        $download_size = filesize($filenameReal);
        header('Pragma: public');
        header('Cache-Control: private');
        header('Cache-Control: no-cache, must-revalidate');
        header('Content-type: text/plain');
        header('Accept-Ranges: bytes');
        header("Content-Length: $download_size");
        header('Connection: close');
        readfile($filenameReal);
        exit;
    }
}
// Just list the PHP source?
check_sourceview();

// get the input parameters
if (isset($_GET["mm"])) {
    $month = intval($_GET["mm"]);
} else {
    die("No 'mm' parameter supplied");
}

if ($month == "") {
    die("Invalid 'mm' parameter supplied");
}

// get the input parameters
if (isset($_GET["dd"])) {
    $day = intval($_GET["dd"]);
} else {
    die("No 'd' parameter supplied");
}

if ($day == "") {
    die("Invalid 'dd' parameter supplied");
}
// Connect to the database
$server ="#####";
$user = "####";
$pwd = "####";
$db ="####";
$con=mysqli_connect($server,$user,$pwd,$db);
If(! $con) {
exit("Echec de la connexion");
}
$qry = "SELECT AVG(t_out_maxi), AVG(t_out_mini) FROM minimaxi WHERE substring(recdateTZ,7,2)= ".$day." and substring(recdateTZ,5,2)= ".$month;
      if ($resultat = mysqli_query($con,$qry))  {  
         while ($row=mysqli_fetch_row($resultat))
                        {
	                     $maxRec = (float)$row[0];
	                     $minRec = (float)$row[1];
                        }
                        mysqli_free_result($resultat);
                        }

 //$query = "SELECT DATE_FORMAT(LogDate,'%b %y'), SUM(TotRainFall) FROM dayfile WHERE LogDate >= DATE_FORMAT(CURDATE() - INTERVAL " . $interval ." MONTH, '%Y-%m-01') GROUP BY DATE_FORMAT(LogDate,'%y%c') ORDER BY DATE_FORMAT(LogDate,'%y%m')";
//SELECT year(logdate) as year, month(logdate) as month, day(logdate) as day, maxtemp, tmaxtemp, mintemp, tmintemp, round(avgtemp,1) as avgtemp, lowwindchill, tlowwindchill, highheatind, thighheatind, highhum, thighhum, lowhum, tlowhum, highdewpoint, thighdewpoint, lowdewpoint, tlowdewpoint, totrainfall, maxrainrate, tmaxrr, highhourrain, thighhourrain, highwindgust, thwindg, highavgwspeed, thavgwspeed, totwindrun, maxpress, tmaxpress, minpress, tminpress FROM dayfile WHERE day(logdate)=day(now()) and month(logdate)=month(now()) ORDER BY year(logdate) DESC 
$qry = "SELECT substring(recdateUTC,1,4),t_out_maxi, t_out_mini, t_out_moy FROM minimaxi WHERE substring(recdateTZ,7,2)= ".$day." and substring(recdateTZ,5,2)= ".$month." ORDER BY substring(recdateTZ,1,4)";
//print_r ($query);
      if ($resultat = mysqli_query($con,$qry))  {  
         while ($row=mysqli_fetch_row($resultat))
                        {
	                     $title[] = $row[0];
	                     $valMax[] = (float)$row[1];
	                     $valMin[] = (float)$row[2];
	                     $valAvg[] = (float)$row[3];
	                     //$valAvg[] = array((float)$row[3]-0.1,(float)$row[3]+0.1);
	                     $valTemp[] = array((float)$row[2], (float)$row[1]);
                       }
                        mysqli_free_result($resultat);
                       }
// put into a single array
$ret = array($title, $valMax,$valMin,$valAvg,$valTemp,$maxRec,$minRec);

header("Content-type: text/json");
echo json_encode($ret);
?>

https://www.meteo-canejan.fr/

ma config : VP2sql , Weaterlink 6.03 , NOAAtable, minimaxibis (sonde agricole), Windows 10 .

Répondre