Hola amigos!.. tengo algo que llevo tiempo intentando hacerlo.. tengo un chart
SELECT
puerto,
year(fecha) AS anho,
month(fecha) AS mes,
SUM(total) AS Sum_Total
FROM mov
GROUP BY puerto, year(fecha)
ORDER BY puerto
y mi idea es: por medio de un form :
<html>
<body>
<form action="mov_Chart_chart.php","include/var_chart.php" method="post">
<SELECT name="anho">
<OPTION VALUE="2011">2011</OPTION>
<OPTION VALUE="2010">2010</OPTION>
<OPTION VALUE="2009">2009</OPTION>
<OPTION VALUE="2008">2008</OPTION>
<OPTION VALUE="2007">2007</OPTION>
</select><br />
<SELECT name="mes">
<OPTION VALUE="1">Enero</OPTION>
<OPTION VALUE="2">Febrero</OPTION>
<OPTION VALUE="3">Marzo</OPTION>
<OPTION VALUE="4">Abril</OPTION>
<OPTION VALUE="5">Mayo</OPTION>
<OPTION VALUE="5">Junio</OPTION>
<OPTION VALUE="7">Julio</OPTION>
<OPTION VALUE="8">Agosto</OPTION>
<OPTION VALUE="9">Setiembre</OPTION>
<OPTION VALUE="10">Octubre</OPTION>
<OPTION VALUE="11">Nobiembre</OPTION>
<OPTION VALUE="12">Dicismbre</OPTION>
</select><br />
<input type="submit" value="Aceptar" />
</form>
</body>
</html>
pasar los parametros year y montn para hacer un where:
SELECT
puerto,
year(fecha) AS anho,
month(fecha) AS mes,
SUM(total) AS Sum_Total
FROM mov
*** -- > "where year(fecha)=".$_POST['anho']." and month(fecha)=".$_POST['mes'].. algo como esto
GROUP BY puerto, year(fecha)
ORDER BY puerto
y despues mostrar el chart