fatmess
01-24-2009, 08:06 PM
Hi,
beginner question,
I get the following error,
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in bla bla bla on line 6
when I run the following W3schools code,
<?php
$q=$_GET["q"];$xmlDoc = new DOMDocument();
$xmlDoc->load("cd_catalog.xml");$x=$xmlDoc->getElementsByTagName('ARTIST');for ($i=0; $i<=$x->length-1; $i++)
{
//Process only element nodes
if ($x->item($i)->nodeType==1)
{
if ($x->item($i)->childNodes->item(0)->nodeValue == $q)
{
$y=($x->item($i)->parentNode);
}
}
}$cd=($y->childNodes);for ($i=0;$i<$cd->length;$i++)
{
//Process only element nodes
if ($cd->item($i)->nodeType==1)
{
echo($cd->item($i)->nodeName);
echo(": ");
echo($cd->item($i)->childNodes->item(0)->nodeValue);
echo("<br />");
}
}
?>
Thanks for any help in resolving this!
beginner question,
I get the following error,
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in bla bla bla on line 6
when I run the following W3schools code,
<?php
$q=$_GET["q"];$xmlDoc = new DOMDocument();
$xmlDoc->load("cd_catalog.xml");$x=$xmlDoc->getElementsByTagName('ARTIST');for ($i=0; $i<=$x->length-1; $i++)
{
//Process only element nodes
if ($x->item($i)->nodeType==1)
{
if ($x->item($i)->childNodes->item(0)->nodeValue == $q)
{
$y=($x->item($i)->parentNode);
}
}
}$cd=($y->childNodes);for ($i=0;$i<$cd->length;$i++)
{
//Process only element nodes
if ($cd->item($i)->nodeType==1)
{
echo($cd->item($i)->nodeName);
echo(": ");
echo($cd->item($i)->childNodes->item(0)->nodeValue);
echo("<br />");
}
}
?>
Thanks for any help in resolving this!