creating XML output in PHP -


i trying create xml file output in php remote phone book on ip phone, here code have:

<?php $conn=mysql_connect("localhost","user","********"); mysql_select_db("db_name",$conn);  header("content-type: text/xml"); header("connection: close"); header("expires: -1"); ?>  <yealinkipphonedirectory> <?php $output='<yealinkipphonedirectory>\n'; $sql="select * contacts "; $rs=mysql_query($sql,$conn); while($result=mysql_fetch_array($rs)) {     $output .= "<directoryentry>\n";     $output .= "<name>mobile:</name>\n";     $output .= "<telephone>" . $result["mobile"] . "</telephone>\n";     $output .= "</directoryentry>\n"; } $output='</yealinkipphonedirectory>\n';  echo '$output'; ?> 

but error message:

this page contains following errors:  error on line 3 @ column 8: content @ end of document below rendering of page first error.  $output 

<?php  $conn=mysql_connect("localhost","user","********"); mysql_select_db("db_name",$conn);  header("content-type: text/xml"); header("connection: close"); header("expires: -1");  $output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $output .= '<yealinkipphonedirectory>\n'; $sql="select * contacts "; $rs=mysql_query($sql,$conn); while($result=mysql_fetch_array($rs)) {     $output .= "<directoryentry>\n";     $output .= "<name>mobile:</name>\n";     $output .= "<telephone>" . $result["mobile"] . "</telephone>\n";     $output .= "</directoryentry>\n"; } $output.='</yealinkipphonedirectory>';  echo $output;  ?> 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -