Author Topic: Error or Notice message started showing up this morning!  (Read 530 times)

0 Members and 1 Guest are viewing this topic.

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Error or Notice message started showing up this morning!
« on: December 01, 2018, 09:48:54 AM »
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?

Code: [Select]
<?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 ]
« Last Edit: December 01, 2018, 01:40:32 PM by dasman »
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: Error or Notice message started showing up this morning!
« Reply #1 on: December 01, 2018, 02:11:13 PM »
That looks like a snippet of code I wrote for someone years ago. The notice messages are displaying now probably due to PHP upgrades.
Try changing the beginning of the file from
Code: [Select]

<?php
    $path_dailynoaa 
$SITE['NOAAdir'];  

to

Code: [Select]
<?php
    ini_set
('display_errors'0);
    
error_reporting(E_ALL & ~E_NOTICE);
    
$path_dailynoaa $SITE['NOAAdir'];  
Murry

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: Error or Notice message started showing up this morning!
« Reply #2 on: December 01, 2018, 04:39:01 PM »
Murry i thought you might have been the one who wrote it, but i wasnt sure. I will try your suggestion when i get home.
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline Murry Conarroe

  • Contributor
  • ***
  • Posts: 143
    • Wildwood Weather
Re: Error or Notice message started showing up this morning!
« Reply #3 on: December 01, 2018, 05:04:36 PM »
Murry i thought you might have been the one who wrote it, but i wasnt sure. I will try your suggestion when i get home.

You also need to update your wxfreeze-include.php file. http://www.wxforum.net/index.php?topic=24301.msg364940#msg364940
Murry

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: Error or Notice message started showing up this morning!
« Reply #4 on: December 01, 2018, 06:10:07 PM »
Murry your fix worked! I have also updated the Freeze script. Thank you so much. =D&gt;
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network