Código PHP:
for(dia=1;dia<=31;dia++,j++){
String fechaCompleta = year+"/"+mes+"/"+dia;
System.out.println("BIEN");
query2 = "Select fkxc,valork,valorc,valord, Max(greatest(hora0430_0530,hora0530_0630,hora0630_0730,hora0730_0830,"+
"hora0830_0930,hora0930_1030,hora1030_1130,hora1130_1230,"+
"hora1230_1330,hora1330_1430,hora1430_1530,hora1530_1630,"+
"hora1630_1730,hora1730_1830,hora1830_1930)) As ValorMax FROM "+" "+elemento+ " WHERE fecha= ? and estacion= ? group by fkxc,valork,valorc,valord";
pst = prepararConsulta(query2);
pst.setString(1, fechaCompleta);
pst.setString(2, estacion);
rst = pst.executeQuery();
rst.next();
fkxc = rst.getDouble("fkxc");
valork = rst.getInt("valork");
valorc = rst.getDouble("valorc");
valord = rst.getDouble("valord");
cad = rst.getDouble("ValorMax");
System.out.println(cad);
System.out.println(fkxc);
System.out.println("C:"+valorc);
System.out.println("D:"+valord);
System.out.println("K:"+valork);
System.out.println(fechaCompleta);
System.out.println(estacion);
tablaDiarios.setValueAt(fkxc, i, 3);
tablaDiarios.setValueAt(valork, i, 4);
tablaDiarios.setValueAt(valorc, i, 5);
tablaDiarios.setValueAt(valord, i, 6);
tablaDiarios.setValueAt(cad, i, j);