# XML from MySQL via PHP

**URL:** https://forum.kirupa.com/t/xml-from-mysql-via-php/332533
**Category:** programming
**Created:** [July 17, 2014, 2:32am UTC](https://forum.kirupa.com/t/xml-from-mysql-via-php/332533 "2014-07-17T02:32:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![James\_Flowers](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@James\_Flowers](https://forum.kirupa.com/u/James_Flowers)
#### Post date: [July 17, 2014, 2:32am UTC](https://forum.kirupa.com/t/xml-from-mysql-via-php/332533/1 "2014-07-17T02:32:06Z")

</div>

hi

using  
[http://www.kirupa.com/web/mysql\_xml\_php.htm](http://www.kirupa.com/web/mysql_xml_php.htm)

I created

[http://www.jamesflowersreports.com/php/xml2.php](http://www.jamesflowersreports.com/php/xml2.php)

using my own database  
using this below

for($x = 0 ; $x \< mysql\_num\_rows($resultID) ; $x++){  
$row = mysql\_fetch\_assoc($resultID);  
$xml\_output .= " \<entry\>  
“;  
$xml\_output .= " \<Name\>” . $row[‘customerName’] . “\</Name\>  
“;  
// Escaping illegal characters  
$row[‘text’] = str\_replace(”&”, “&amp”, $row[‘text’]);  
$row[‘text’] = str\_replace("\<", “\<”, $row[‘text’]);  
$row[‘text’] = str\_replace("\>", “\>”, $row[‘text’]);  
$row[‘text’] = str\_replace(""", “”", $row[‘text’]);  
$xml\_output .= " \<Number\>" . $row[‘customerNumber’] . "\</Number\>  
";  
$xml\_output .= " \</entry\>  
";  
}

$xml\_output .= “\</entries\>”;

if I have a whitespace in CustomerName , it craps out , but replace that with a number it works fine.

is it like a whitespace etc?

Regards

JAmes
