Re: php bug?

From: Date: Mon, 27 Sep 2010 11:29:55 +0000
Subject: Re: php bug?
References: 1 2 3  Groups: php.xml.dev 
Request: Send a blank email to [email protected] to get a copy of this message
 On 9/27/10 4:06 AM, mcberta2 wrote:
On 9/26/2010 6:34 PM, Adam Trachtenberg wrote:
On Sun, Sep 26, 2010 at 12:36 AM, mcberta2<[email protected]> wrote:
Hello everyone. The following is an extract of a routine returning error messages from a xml file: function title($index) { $xml = simplexml_load_file("lingo.xml"); return $xml->message[$index]; } The problem is that if I call the routine with a value [ex. title(6)] I receive the message, whereas if I call the routine with a variable [ex. title($value) where $value=6] there is no way I can receive the message. I tried in many different ways but it looks like it's a bug of simple_xml.
This isn't too helpful, but I'm 99.94% it's something in your code. Simplify your code until you find the shortest piece that works and then add back lines until you find your error. -adam
Thank you for coming to help. That's what I did. The routine can't get shorter than that. I attach now the xml file (shortest version). Just to be clear: <?xml version="1.0" encoding="utf-8"?> <messages> <message id="0">About us</message> <message id="1">Nothing has been ordered!</message> <message id="2">Continue shopping</message> <message id="3">Shopping cart</message> <message id="4">Contact us</message> <message id="5">News</message> <message id="6">Welcome</message> </messages> Am I referencing the nodes incorrectly? Thank you Andrea
How about the full script as you don't include how/what you are passing to the title function. Rob

Thread (7 messages)

« previous php.xml.dev (#631) next »