Salut,
Je ne vois pas où est mon erreur :
Cela me renvoie une erreur sur la ligne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 $annee = $_GET['annee']; mysql_query ("CREATE TEMPORARY TABLE temps_temp (`id_mois` int(11) default NULL, `annee` decimal(10,1) default NULL, `temp_max` decimal(10,1) default NULL, `temp_min` decimal(10,1) default NULL, PRIMARY KEY (`id_mois`));"); mysql_query ("INSERT INTO temps_temp (SELECT Month( date_eau ), Year( date_eau ), Max( temp_max ), Min( temp_min ) FROM temps_eau WHERE Year( date_eau ) = $annee GROUP BY Month( date_eau ));"); $sql = "SELECT temps_mois.id_mois, temps_mois.lib_mois, temps_temp.temp_max, temps_temp.temp_min FROM temps_temp INNER JOIN temps_mois ON temps_mois.id_mois = temps_temp.id_mois GROUP BY temps_temp.id_mois;"; $x1 = array(); $y1 = array(); $y2 = array(); $result = mysql_query($sql); while ($row = mysql_fetch_array($result)){ $x1[] = $row['lib_mois']; $y1[] = $row['temp_max']; $y2[] = $row['temp_min']; }
Hors si j'exécute le code qui correspond au code cela fonctionne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part while ($row = mysql_fetch_array($result))...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 CREATE TEMPORARY TABLE temps_temp (`id_mois` int(11) default NULL, `annee` decimal(10,1) default NULL, `temp_max` double NOT NULL, `temp_min` double NOT NULL, PRIMARY KEY (`id_mois`)); INSERT INTO temps_temp (SELECT Month( date_eau ), Year( date_eau ), Max( temp_max ), Min( temp_min ) FROM temps_eau WHERE Year( date_eau ) = 2008 GROUP BY Month( date_eau )); SELECT temps_mois.id_mois, temps_mois.lib_mois, temps_temp.id_mois, temps_temp.temp_max, temps_temp.temp_min FROM temps_temp INNER JOIN temps_mois ON temps_mois.id_mois = temps_temp.id_mois![]()
![]()
![]()
![]()
Partager