I've got a php file which prints an xml with different MySql db.

I recieve a mistake each time at exactly the stage where there's an &lifier sign.

Here's some php:

$query = mysql_query($sql);

$_xmlrows = '';

while ($row = mysql_fetch_array($query)) {
    $_xmlrows .= xmlrowtemplate($row);
}

  function xmlrowtemplate($dbrow){
  return "<AD>
            <CATEGORY>".$dbrow['category']."</CATEGORY>
          </AD>
  }

The output is exactly what I would like, i.e. the file results the right category, but nonetheless gives a mistake.

The mistake states: xmlParseEntityRef: no title

After which it indicates the precise character the industry &lifier sign.

This gripes only when the $dbrow['category'] is one thing by having an &lifier register it, for instance: "cars &lifier trucks", or "computer systems &lifier telephones".

Anybody understand what the issue is?

BTW: I've the encoding set to UTF-8 in most documents, along with the xml output.

& in XML begins an entity. While you haven't defined an entity &WhateverIsAfterThat a mistake is tossed. You need to escape it with &amp;.

$string = str_replace('&', '&amp;', $string);

How do I escape ampersands in XML

To flee another reserved figures:

function xmlEscape($string) {
    return str_replace(array('&', '<', '>', '\'', '"'), array('&amp;', '&lt;', '&gt;', '&apos;', '&quot;'), $string);
}

You have to either turn & into its entity &amp;, or wrap the contents in CDATA tags.

When you purchase the entity route, you will find additional figures you have to become organizations:

>  &gt;
<  &lt;
'  &apos;
"  &quot;

Background: Beware of the ampersand when using XML

Wikipedia: List of XML character entity references