1024programmer PHP Brother, I used flex+php+mysql to read data and it showed that there were related problems! How can I change the writing?

Brother, I used flex+php+mysql to read data and it showed that there were related problems! How can I change the writing?

I used flex+php+mysql to read data and there was a problem! How can I change the writing? ?
This is the code for BookDAO.php:

<?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 “\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: Since I can’t put a picture, I simply counted the results:
Hello!
This is the content of the data displayed by the datagrid. The auhtor tag is also displayed on the page, instead of just displaying the content “Hello!” . . .
Looking for a way to write it?

——Solution——————–
htmlspecialchars() Put your XML string in it and print it out. This is because you did not specify the content-type with the Header.

You can directly header(“Content-Type:xml”);, the code behind remains unchanged, and the browser can still print out tagged XML.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/brother-i-used-flexphpmysql-to-read-data-and-it-showed-that-there-were-related-problems-how-can-i-change-the-writing/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索