I\'m getting this error:
error on line 4 at column 1: Extra content at the end of the document
with this code:
$this-&g
After spending about 3 days on this very same problem, I have come to find the best and easiest way to get past this may be affffding the folling headers to the code:
header("Content-type: text/xml");
header( 'Content-Disposition: attachment; filename='.$_SESSION['WorkTable'].'_contacts-'.$date.'.xml');
Add this to your code between this lines:
$query = $query->result_array();
//add it here <--
header("Content-type: text/xml");
Without seeing the text output itself, it would be impossible to know for sure, but there are a couple of things I noticed immediately:
header("Content-type: text");
.&
after replacing everything else with an entity. This means you're getting, &lt;
instead of <
.str_replace
takes arrays as parameters, you would be best using them.