Hi Chris and Dennis, The best way I can explain what they did is to pass the info they sent me via email.
This is what they sent me.
----------------------------------------------------------------------------------------------------
The problem does not seem to be with our server but with the PHP code
itself.
The PHP code (wxriverpage.php) uses simpleXML to parse the
river-XXX.txt files and breaks out the information in those XML into
different variables that are then used to generate the webpage based
on a bunch of if statements that uses math operations for comparisons.
The problem is that simpleXML returns values that are of type "Object"
and the comparisons utilize the number_format() function and this
function does not seem to know what to do with an "Object" variables.
So even though variables like $ObsStage seemed to have a valid integer
/ float value associated to it, number_format() would return a null or
something else that would make the comparisons invalid / wrong thus
generating the wrong results for the page output.
A simple fix was to convert the simpleXML objects to something that
number_format() likes so I update the code to convert all the
simpleXML objects to strings and the page now renders correctly.
Sample: Before
$ObsStage = $xmlData["$riverid"]->observed->datum[0]->primary;
After:
$ObsStage = (string)$xmlData["$riverid"]->observed->datum[0]->primary;
This seems to be a common issue coders run into when trying to use
math operations on variables created from simpleXML.
http://www.php.net/manual/en/book.simplexml.php#95762http://www.php.net/manual/en/book.simplexml.php#94105I'm not sure why the unmodified code seems to work on your other host
provider and not on our server but my guess is that our servers are
running different versions of PHP and they changed something between
versions.
-----------------------------------------------------------------------------------------
What I have is a big band aid on that script within the server to make it work. My server is running the lastest PHP which is PHP 5.3.3 The script worked fine on my go daddy server, but that was PHP 5.2.8 I am still curious if anybody else is running version PHP 5.3.3. with this script.
Dennis I like what you have done with Jim at Juneau County Weather on the clickable map. Let me know if you do get a fix for this, or something you want me to test on my server. I will keep checking for updates. Also what this script does is so good it is well worth it.
Again thank you very much Scott