I have a XML file I am working with. This file has been created by hand and I now need to develop a PHP script that will create it in the same format.

Here is what I have thus far:

Code:
$query = "select * from " . $table_name . " ORDER BY stateID ASC";
$result = mysql_query($query, $connection) or die("Could not complete database query");
$num = mysql_num_rows($result);
...