The only thing I can think of is the query is returning empty on the wind data. That comes from a different table called WindData. But the dailynoaareport shows the correct data so that rules that out because the SELECT statements are the same.
The data is put in the file differently in the climate report. The noaa report puts it a line at a time while the climate one gets aall the data and puts it a column at a time. For some reason, your data is failing the the IF statement in function Put_row at the end of the script. I check to see if there is something in the value passed and we are not past the last day in the month. so 1 of 2 things is happening. Either your days_in_month is getting set wrong, which can't be because all the other reading get put in correctly, or your query is returning nothing. The data is put in an array, it the case of the wind, they are $Ave_windspd, $Ave_wind_dir, $gust and $gust_dir. Yours seems to be getting set to "" for each day. You can check the query by putting something like:
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
after the query at line 115.
If that passes, I would put an echo statement somewhere in the while loop that starts at line 121 to output some of the values that were returned, like echo $row['Windspeed_kmh']."<br />"; , or any other variable you want to check the value of. Your file would look messed up while testing but if you only do it on one month, once you find where the data is getting corrupt, you would fix the problem then run that month again.