Why can't php echo XML? & Lt ;? Phprequire_once (& quot; conn. php & quot;); header (& quot; Content-type: textxml & quot;); $ querySELECT * FROMtestorderbynodesc; $ resultmysql_query (why can't php echo XML with $ qu, what's the problem?
Require_once ("conn. php ");
Header ("Content-type: text/xml ");
$ Query = 'select * FROM test order by no desc ';
$ Result = mysql_query ($ query );
Echo" ";
While ($ row = mysql_fetch_assoc ($ result )){
Echo" ". $ Row-> no ." ";
Echo" ". $ Row-> ch ." ";
Echo" ". $ Row-> f ." ";
}
Echo" ";
Mysql_close ();
?>
Conn. php and database are okay. The file format is UTF-8.
Prompt in the browser:
The XML page cannot be displayed.
You cannot view XML input using a style sheet. Correct the error and click refresh or try again later.
--------------------------------------------
The top-level of the document is invalid. An error occurred while processing the resource 'http: // localhost/getXML. php. Row 1st, Location: 1
?
^
------ Solution --------------------
Mysql_fetch_assoc or mysql_fetch_object
The reason why the XML page cannot be displayed is that you disable the error message and use the IE browser.
------ Solution --------------------
The first one shown above is?
You have to check whether there are any mistakes in your page code.
However, xml is really annoying. I have tried to output xml, but some of them are normal and some are abnormal in some browsers ..
------ Solution --------------------
Could you change to firefox?
------ Solution --------------------
Discussion
I did not go down to Firefox.
Can the code be correctly displayed in your browser?