# Mysql to xml output

**URL:** <https://forum.kirupa.com/t/mysql-to-xml-output/248091>\
**Category:** Uncategorized\
**Created:** [January 3, 2008, 6:11pm UTC](https://forum.kirupa.com/t/mysql-to-xml-output/248091 "2008-01-03T18:11:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tge1986](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@tge1986](https://forum.kirupa.com/u/tge1986)\
**Post date:** [January 3, 2008, 6:11pm UTC](https://forum.kirupa.com/t/mysql-to-xml-output/248091/1 "2008-01-03T18:11:07Z")

</div>

I’ve followed the tutorial on the site but i can’t get it to format the data the way i need it here is the php code.

```php

 <?php

include_once"conn.php";

$query = "SELECT * FROM points ORDER BY id DESC";
$resultID = mysql_query($query) or die("Data not found.");

$xml_output = "<?xml version=\"1.0\"?>
";

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);
    $xml_output .= "	'<marker>
";
    $xml_output .= "lat=" .'"'. $row['lat'] .'"';
    $xml_output .= "lng=" .'"'. $row['lng'] .'"';
    $xml_output .= "title=" .'"'. $row['title'] .'"';
    $xml_output .= "note=" .'"'. $row['note'] .'"';
}

$xml_output .= "</marker>";

echo $xml_output;

?> 

```

and it outputs like this  
’ lat="41.8905"lng="12.4925"title="Colosseo"note=“blog”

I need it to output like this  
\<marker lat=“41.8905” lng=“12.4925” title=“Colosseo” note=“blog” icon=""/\>
