You are here: Re: Storing objects in a session PHP 5.2.0 « PHP Programming Language « IT news, forums, messages
Re: Storing objects in a session PHP 5.2.0

Posted by Anthony Smith on 11/29/06 20:31

The problem was with sing simple_xml I saw a few posts like this but I
thought it did not apply to what I was doing. Well it did. I just
needed to cast the xml attribute to a string:

$role->setSysName((string)$xml->roles[$i]->systemName);

Code Snippet:

//Turn the xml into an object. Easier to parse this way. Maybe a XSD is
an option?
$xml = simplexml_load_string($xml,'SimpleXMLElement',LIBXML_NOCDATA);

//First look at the message to see if any roles exist for the user. We
can look at the
//roleStatus message which will have a vale or true or false.
if ($xml->message->roleStatus == "true"){

//Loop through all of the user's roles
for($i = 0; $i != count($xml->roles); $i++){

//Create a role object for each role.
$role = new Role();
//Typecast any data from simplexml functions. Otherwise
//errors will appear such as: "Node no longer exists in
$role->setSysName((string)$xml->roles[$i]->systemName);


Carl wrote:
> Anthony Smith wrote:
> > I receive errors like these:
> > <b>Parse error</b>: syntax error, unexpected T_VARIABLE in
> > <b>/home/as411161/apache/htdocs/common/vcp_menu2.php</b> on line
> > <b>14</b><br />
>
> Anthony,
>
> This is a parse error and most likely not related to objects or
> sessions. My first guess would be a missing semicolon. Check the end of
> line 13 in your vcp_menu2.php source.
>
> Hope that helps,
> Carl.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация