Page 1 of 1

Problem with loading XML

Posted: Thu Jan 31, 2013 11:39 am
by FrederickGeek8
I wrote a small PHP program on my Mac and it ran fine. Now if I run it on my main Ubuntu server, it does not work. What did I do wrong? I checked all the permissions.
function get_pool($number){
	$xml = simplexml_load_file("odds.xml");
	$pool = $xml->pool[$number]->currpool;

	return $pool;
}
my xml looks like this
<?xml version="1.0"?>
<stats>
	<pool>
		<currpool>10</currpool>
	    <playerslost>1</playerslost>
	    <players>2</players>
	    <origpool>10</origpool>
	</pool>
	<pool>
		<currpool>25</currpool>
	    <playerslost>1</playerslost>
	    <players>2</players>
	    <origpool>25</origpool>
	</pool>
</stats>

Re: Problem with loading XML

Posted: Fri Feb 01, 2013 2:05 pm
by FrederickGeek8
Sorry I forgot to post the error.
Notice: Trying to get property of non-object in /var/www-nerd/coin/functions.inc.php on line 65 Notice: Undefined variable: min in /var/www-nerd/coin/dice.php on line 15 Notice: Undefined variable: min in /var/www-nerd/coin/dice.php on line 16 Notice: Undefined variable: min in /var/www-nerd/coin/dice.php on line 15 Notice: Undefined variable: min in /var/www-nerd/coin/dice.php on line 16 Notice: Undefined variable: min in /var/www-nerd/coin/dice.php on line 15 Notice: Undefined variable: min in /var/www-nerd/coin/dice.php on line 16 Your lucky number are: -5 3 3 Loser Notice: Trying to get property of non-object in /var/www-nerd/coin/functions.inc.php on line 23 Notice: Trying to get property of non-object in /var/www-nerd/coin/functions.inc.php on line 25 Notice: Trying to get property of non-object in /var/www-nerd/coin/functions.inc.php on line 27 Notice: Trying to get property of non-object in /var/www-nerd/coin/functions.inc.php on line 29 Notice: Trying to get property of non-object in /var/www-nerd/coin/functions.inc.php on line 31 Notice: Trying to get property of non-object in /var/www-nerd/coin/functions.inc.php on line 51 Notice: Indirect modification of overloaded element of SimpleXMLElement has no effect in /var/www-nerd/coin/functions.inc.php on line 51 Notice: Indirect modification of overloaded element of SimpleXMLElement has no effect in /var/www-nerd/coin/functions.inc.php on line 52 Notice: Indirect modification of overloaded element of SimpleXMLElement has no effect in /var/www-nerd/coin/functions.inc.php on line 53 

Re: Problem with loading XML

Posted: Tue Feb 05, 2013 1:01 am
by jacek
Lets start form the first error since the others are probably caused by that.
Notice: Trying to get property of non-object in /var/www-nerd/coin/functions.inc.php on line 65 
Assuming that line 65 is
$pool = $xml->pool[$number]->currpool;
This means that either $xml is not an object or $xml->pool[$number] is not, the second one makes more sense since there are no errors from the load function.

So maybe try adding a
var_dump($xml);
and see if the path is as you expect.