River/Lake Height Display addon page for WD-AJAX-PHP-USA

As our streams are now back in their banks and with little immediate chance of rain, the NWS is backing off on forecasting most of our local river heights. This has left errors in any forecast with less than seven valid entries.

A fix for this in ‘riverdetail.php’ is to add a check for a valid forecast entry before attempting to display one by changing

while($i<$j+7){ ?>

to

while($xmlData->forecast->datum[$i]->valid && $i<$j+7){ ?>

This eliminates riverdetail.php’s attempt to display seven forecasts when less than seven exist. This forecast currently shows 4 forecast entries, but as time progresses they will dwindle to none after tomorrow, May 13.