I'm creating a xml file with PHP here is some sample code.
$myFile = "example_file.xml";
$fh = fopen($myFile, 'w');
while($row = mysql_fetch_array($result))
{
$stringData = "<field name=\"id\">$page_id</field>
<field name=\"url\">http://myfundi.co.za/a/$page_url</field>
<field name=\"title\">$pagetitle</field>
<field name=\"content\">$bodytext</field>
<field name=\"site\">Myfundi</field>";
fwrite($fh, $stringData);
}
fclose($fh);
What I need to do is when the first content is written to the text file, I need to prepend and append some more text.
I need to prepend and append to the data that already exists.
How can I do that?
Thanks