Downloadable Output of XML file with PHP



I work with MySQL database. I want to view the output of my query as a downloadable xml file. I can't use SimpleXML or XMLWriter because I use the php 4.Could you help me to find the way. Here is the code for getting the data. I should say that the data is layered and dependant in each other.



<!DOCTYPE HTML>
<html>
<body>
<?php

// Establish db connection

require_once ('config.php');

//view feature form by index of feaure name and target release

$sql= ("SELECT * FROM GeneralProperty
WHERE fname= '$_POST[fname]' AND target= '$_POST[target]'");
$result=mysql_query($sql)
OR die ("Error: $sql <br>".mysql_error());
echo "<table>";

while ($row =mysql_fetch_array($result))
{
echo "<tr>";
echo "<th align=left>" .'Feature Name (FAJ xxxx/x):'. "</th>";
echo "<td>". $row['fname']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th align=left>" .'Target Release:'. "</th>";
echo "<td>". $row['target']."</td>";
echo "</tr>";
}
echo "</table>";
echo "<hr/>";

// view commands of the feature

$sql2= ("SELECT * FROM command
WHERE fname= '$_POST[fname]' AND target= '$_POST[target]'");
$result2=mysql_query($sql2)
OR die ("Error: $sql2 <br>".mysql_error());
echo "<table>";
//$cnum=1;//command counter
while ($row =mysql_fetch_array($result2))
{
echo "<tr>";
echo "<th align=left>".' Changed Command'. "</th>";
echo "<td>". ''. "</td>";
echo "</tr>";
echo "<tr>";
echo "<th align=left>".' Type:'. "</th>";
echo "<td>". $row['c_type']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th align=left>".' Command Slogan:'. "</th>";
echo "<td>". $row['c_code']. "</td>";
echo "</tr>";
echo "<tr>";
echo "<th align=left>".' Command Title:'. "</th>";
echo "<td>". $row['c_title']."</td>";
echo "</tr>";
echo "<tr>";
echo "<th align=left>".' Description:'. "</th>";
echo "<td>". $row['c_des']."</td>";
echo "</tr>";
//$cnum=$cnum+1;
}
echo "</table>";
echo "<hr/>";
?>
</body>
</html>

No comments:

Post a Comment