# Output XHML with PHP

**URL:** <https://forum.kirupa.com/t/output-xhml-with-php/294505>\
**Category:** programming\
**Created:** [August 15, 2009, 5:45am UTC](https://forum.kirupa.com/t/output-xhml-with-php/294505 "2009-08-15T05:45:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jupityjupe](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@jupityjupe](https://forum.kirupa.com/u/jupityjupe)\
**Post date:** [August 15, 2009, 5:45am UTC](https://forum.kirupa.com/t/output-xhml-with-php/294505/1 "2009-08-15T05:45:37Z")

</div>

Hi folks,  
using the tutorial on this web site I have managed to get most of the script to work but I am stuck with a pair of brackets. Can anyone point out where I am going wrong. Here is my code

$query = “SELECT idno, name, shortDescription, largePicture, location, thumbnails, exhibition FROM nixSculptures WHERE exhibition = ‘no’ AND location = ‘Recent’ ORDER BY nixSculptures.idno DESC”;  
$resultID = mysql\_query($query, $linkID) or die(“Data not found.”);  
$xml\_output = "\<?xml version=“1.0”?\>  
";  
$xml\_output .= "\<gallery\>  
";

$xml\_output .= "\<category caption=‘RECENT WORK’\>  
";

for($x = 0 ; $x \< mysql\_num\_rows($resultID) ; $x++){  
$row = mysql\_fetch\_assoc($resultID);  
$row[‘shortDescription’] = str\_replace("&", “”, $row[‘shortDescription’]);  
$row[‘shortDescription’] = str\_replace("\<", “”, $row[‘shortDescription’]);  
$row[‘shortDescription’] = str\_replace("\>", “”, $row[‘shortDescription’]);  
$row[‘shortDescription’] = str\_replace(""", “”, $row[‘shortDescription’]);

```
$xml_output .= '&lt;img src="../admin/main/' . $row['largePicture'] . '"caption="' . $row['name'] . '"comment="' . $row['shortDescription'] .'"/&gt;';
$xml_output .= "&lt;description&gt;

```

";  
$xml\_output .= “\<![CDATA[  
\<p lign=‘justify’\>\<font face=‘Tahoma’ size=‘11’ color=’#707070’\>”. $row[‘shortDescription’]. "\</font\>\</p\>  
";  
$xml\_output .= "]]\>  
";  
$xml\_output .= "\</description\>  
";  
}  
$xml\_output .= “\</category\>”;   
$xml\_output .= “\</gallery\>”;

echo $xml\_output;

Its is the closing ]] that I believe are causing me problems. See [http://www.nicolahenshaw.co.uk/test/gallery2.php](http://www.nicolahenshaw.co.uk/test/gallery2.php) for the result - the brackets are visible on the page and the closing tag and obviously shouldn’t be. Many thanks
