php를 통해서 xml에 기록하고 파싱하려고 하는데요
아래 php 파일로 도대체 왜 xml 에 안써지는지 모르겠네요 ㅠㅠ
DB에 데이터 있는거하고 echo를 통해서 직접 데이터 확인했는데
안되네요 ㅠㅠ 부탁드릴게요
<head>
<meta http-equiv = "content-Type" content = "text/html" charset = "utf-8">
</head>
<?
$connect = mysql_connect("127.0.0.1, "root", "ehfvl3");
mysql_selectdb("bookdb");
mysql_query("set names utf8");
$qry = "select * from books";
$result = mysql_query($qry);
$xmlcode = "<?xml version = \"1.0\" encoding = \"utf-8\"?>\n";
while($obj = mysql_fetch_object($result))
{
$name = $obj->name;
$price = $obj->price;
$xmlcode .= "<node>\n";
$xmlcode .= "<name>$name</name>\n";
$xmlcode .= "<price>$price</price>\n";
$xmlcode .= "</node>\n";
}
$dir = "C:/APM_Setup/htdocs/";
$filename = $dir."/searchresult.xml";
file_put_contents($filename, $xmlcode);
?>



