I used flex + php + mysql to read data! How can I change the writing style?
Source: Internet
Author: User
I used flex + php + mysql to read data and showed that something went wrong! How can I change the writing method ?? This is the code of BookDAO. php: & lt ;? Php & nbsp; $ link & nbsp; = & nbsp; mysql_connect ("localhost ","***","***"); & nbsp I encountered a problem reading data using flex + php + mysql! How can I change the writing method ??
This is the code of BookDAO. php:
$ Link = mysql_connect ("localhost ","***","***");
Mysql_select_db ("book ");
Mysql_query ("set names 'utf8 '");
/* Return books in XML format */
$ SQL = 'select * FROM books ';
$ Result = mysql_query ($ SQL );
Echo" ";
Echo" \ N ";
While ($ row = mysql_fetch_array ($ result )){
Echo" ". $ Row [" id "]." ";
Echo "". $ row ["author"]."";
Echo" ". $ Row [" title "]."\ N ";
Echo" ". $ Row [" genre "]." \ N ";
Echo" ". $ Row [" price "]." \ N ";
Echo" ". $ Row [" publish_date "]." \ N ";
Echo" ". $ Row [" description "]." \ N ";
}
Echo" \ N ";
Mysql_close ($ link );
?>
The result displayed in mxml is as follows: I will simply count the result as a result because it cannot be separated:
Hello!
This is the content of the data displayed in the datagrid. the auhtor label is also displayed on the page, instead of displaying "Hello !" This content ....
Write?
------ Best solution --------------------
Htmlspecialchars () puts your XML string and prints it out. this is because you didn't use the Header to specify the content-type.
You directly use the header ("Content-Type: xml");, and the subsequent code remains unchanged. the browser can print the XML with tags.
------ Other solutions --------------------
Change the header: header ("Content-Type: xml ");
------ Other solutions --------------------
How to change it? I have never used this. I don't know how to change it? Let's write an example.
------ Other solutions --------------------
I added this header, but it does not play any role.Output ······
------ Other solutions --------------------
I added this header, but it does not play any role.Output ······
------ Other solutions --------------------
Whether you want tags or not.
------ Other solutions --------------------
Do not label
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.