Bonjour à tous
je refais mon site et j'en ai profité pour reprendre bon nombre des scripts dont particulièrement les graphiques ou scripts qui utilisent encore
mysql_connect et les remplacer par mysqli_connect.
j'y suis arrivé quasiment tout le temps mais là j'avoue que dans les fichiers de ce graphique c'est un peu plus compliqué, du moins pour moi.
que faut t'il modifier pour passer en mysqli_connect ?
http://mobile.meteo-canejan.fr/isto-jours-mois.php
tous les fichiers sont à peu prés construit pareil, si quelqu'un pouvais me venir en aide , le code de la température du jour en dessous :
fichier : historicDayTemp_modif.php
Code : Tout sélectionner
<?php
include ('db_ro_details_gw.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
$con=@mysql_connect($dbhost,$dbuser,$dbpassword);
if (!$con) { echo "failed to connect to the database server"; exit(); }
if (!mysql_select_db($database,$con)) { echo "Failed to connect to the database on the server"; exit(); }
#
# The db querys
#
$result = mysql_query("SET lc_time_names = 'en_EN'");
$result = mysql_query("SET time_zone='+1:00'");
if (!$result) { printf ("ERROR - TZ Statement"); exit; }
//if (!$result) { printf ("ERROR - time name"); exit; }
$result = mysql_query("SET NAMES utf8");
$query = "SELECT AVG(t_out_maxi), AVG(t_out_mini) FROM minimaxi WHERE substring(recdateTZ,7,2)= ".$day." and substring(recdateTZ,5,2)= ".$month;
$result = mysql_query($query);
if (!$result) {
die("ERROR - Bad Select Statement");
}
while($row = mysql_fetch_row($result)) {
$maxRec = (float)$row[0];
$minRec = (float)$row[1];
}
//$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
$query = "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);
$result = mysql_query($query);
if (!$result) { printf ("ERROR - Bad Select Statement"); exit; }
// import the rows and put the data into arrays
while($row = mysql_fetch_row($result)) {
$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]);
}
// put into a single array
$ret = array($title, $valMax,$valMin,$valAvg,$valTemp,$maxRec,$minRec);
header("Content-type: text/json");
echo json_encode($ret);
?>
Dominique