On my index page I have a script that(cant remember the author) shows records and averages for this date. The script is stationrecords.php. I have the following text that started to show up this morning with the table the script displays:
Notice: Undefined offset: 4 in /home/ybuhhqulwjts/public_html/stationrecord.php on line 25
Notice: Undefined offset: 4 in /home/ybuhhqulwjts/public_html/stationrecord.php on line 30
Notice: Undefined offset: 4 in /home/ybuhhqulwjts/public_html/stationrecord.php on line 31
Notice: Undefined offset: 8 in /home/ybuhhqulwjts/public_html/stationrecord.php on line 34
Notice: Undefined offset: 10 in /home/ybuhhqulwjts/public_html/stationrecord.php on line 38
After these notices the table the script generates seems to be functioning. I have included part of the code to the station records script. It seems the notices have to do with row #s that are designated in the script like this [4]. This Notice started this morning and I have not touched the script at all this year. Any ideas? Also if the script is functioning how can I turn off these notices?
<?php
$path_dailynoaa = $SITE['NOAAdir'];
$cmonth = (date("n"))-1;
$cyear = date("Y");
$today = date("j");
$year_ctr = 2008; // first year of NOAA data available
$station_high_temptotal = $station_low_temptotal = 0;
$total_days_found = 0;
$record_high_for_today = -999; // Initialize high to a very low temp
$record_low_for_today = 999; // Initialize low to a very high temp
$record_rain_for_today = $record_windgust_for_today = -1;
while($year_ctr <= ($cyear-1)){ // Start of year loop
$filename = get_noaa_filename($year_ctr,$cmonth,$SITE['WXsoftware'],0);
$noaadata = array_values(getnoaafile($path_dailynoaa . $filename,$year_ctr,0));
$rows_of_data=count($noaadata);
$row = 0;
while ($row < $rows_of_data){ // Start of daily loop
if ($today == $noaadata[$row][0]){ // Only want data for this day of the year
$total_days_found++ ; // to get record and average temperature for today's date
$station_high_temptotal = $station_high_temptotal + $noaadata[$row][2];
$station_low_temptotal = $station_low_temptotal + $noaadata[$row][4];
if ($noaadata[$row][2] > $record_high_for_today){ // if temp higher than current record, update
$record_high_for_today = $noaadata[$row][2];
$record_high_year = $year_ctr; // get the year of the record high
}
if ($noaadata[$row][4] < $record_low_for_today){ // if low lower than current record, update
$record_low_for_today = $noaadata[$row][4];
$record_low_year = $year_ctr; // get the year of the record low
}
if ($noaadata[$row][8] > $record_rain_for_today){ // if highter than current record, update
$record_rain_for_today = $noaadata[$row][8];
$record_rain_year = $year_ctr; // get the year of the record
}
if ($noaadata[$row][10] > $record_windgust_for_today){ // if higher than current record, update
$record_windgust_for_today = $noaadata[$row][10];
$record_windgust_year = $year_ctr; // get the year of the record
}
break;
} // end of today only
$row++;
} // end of daily loop
$year_ctr++;
} // end of year loop
[ You are not allowed to view attachments ]