<?php
$sql = "SELECT xxxx FROM xxxx";
$result = mysql_query($sql, $con);
if ($result) {
while ($row = mysql_fetch_array($result)) {
$jobtitle = $row["xxxx"];
echo $jobtitle . "<br/>"; //output should be in xml format as given below
}
}
在上面的示例代码中,我使用echo
.
但我想要 XML 格式的输出;那就是我应该得到类似于:
<all>
<jobtitle>job1</jobtitle>
<jobtitle>job2</jobtitle>
</all>
目前我得到的输出为:
job1
job2