sreejith_y
asked on
PHP + domdocument + start line expected. <
HI All,
Following is my code for generating an xml with employee details. I am using PHP 5.2.1
$result = mysql_query ("select * from tblemployee" ) ;
if (mysql_num_rows($result) != 0)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument;
$doc->formatOutput = true;
$videolibrary = $doc->createElement("EmpGr oup");
$videolibrary = $doc->appendChild($videoli brary);
while ($row = mysql_fetch_array($result) )
{
$video = $doc->createElement("Group ");
$video->setAttribute("grp_ name" , $row['Emp_Grp']);
$video = $videolibrary->appendChild ($video);
}
$xml_string = htmlentities($doc->saveXML ());
echo ("&status=success&output=$ xml_string &");
}
But the script is giving following error.
domdocument - start tag expected <
Please help me.
Thanks in Advance
Following is my code for generating an xml with employee details. I am using PHP 5.2.1
$result = mysql_query ("select * from tblemployee" ) ;
if (mysql_num_rows($result) != 0)
{
$doc = new DOMDocument('1.0');
$doc = new DOMDocument;
$doc->formatOutput = true;
$videolibrary = $doc->createElement("EmpGr
$videolibrary = $doc->appendChild($videoli
while ($row = mysql_fetch_array($result)
{
$video = $doc->createElement("Group
$video->setAttribute("grp_
$video = $videolibrary->appendChild
}
$xml_string = htmlentities($doc->saveXML
echo ("&status=success&output=$
}
But the script is giving following error.
domdocument - start tag expected <
Please help me.
Thanks in Advance
ASKER
I have tried both seperately.. But same error is coming..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$doc = new DOMDocument('1.0');
$doc = new DOMDocument;
try dropping the first one