Write to XML file with certain formatting
Posted: Sun Feb 11, 2007 8:19 am
Hello
I have the following PHP code which produces a table with "Subcategory" & "Time"
I wish to write the values to an XML file with certain formatting as follows
The "Data title=" are the "subcategory" and the "value=" is the "Time"
Hope this makes sence
Thanks
geoff
I have the following PHP code which produces a table with "Subcategory" & "Time"
Code: Select all
include("conn.php");
$result = mysql_query("SELECT subcategory, SUM(time) FROM live inner join category on cat = cat_id inner join subcategory on subcat = subcat_id where cat = '1' AND Date BETWEEN '2006-10-01'AND'2009-10-04' GROUP BY subcat") or die(mysql_error());
echo "<table Align ='center' border='1'>";
echo "<tr> <th>Sub Category</th> <th>Time</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['subcategory'];
echo "</td><td>";
echo $row['SUM(time)'];
echo "</td><td>";
}
echo "</table>";Code: Select all
<Pie title="Sustaining Engineering YTD">
<Data title="Manufacturing" value="0.60" pullOut="true"/>
<Data title="Administration" value="0.60" pullOut="false"/>
<Data title="Approvals" value="0.40" pullOut="false"/>
<Data title="IT" value="2.40" pullOut="false"/>
<Data title="Engineering Documents" value="3.60"/>
</Pie>Hope this makes sence
Thanks
geoff