hello ppl!
i have a xml file and i refresh it with a php file...
into the php file i have a query which i retrieve my data from a sql db...the output result is n't the right...because it "write" to the xml file only the last record from db...look what i mean:
php file:
<?php
@include("xconf.php");
$query = "SELECT * FROM images";
$result = mysql_query($query);
while($oz = mysql_fetch_array($result))
{
$myFile = "data.xml";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "<?xml version=\"1.0\" encoding=\"ISO-8859-7\" ?>\n\n<gallery>\n\n<photos>\n";
fwrite($fh, $stringData);
$stringData = "<photo>\n<thumb src=\"$oz[mikro]\" />\n<img src=\"$oz[s]\" />\n<caption text=\"$oz[title]\" />\n<desc> <![CDATA[$oz[per]]]> </desc>\n</photo>\n\n";
fwrite($fh, $stringData);
$stringData = "</photos>\n\n";
fwrite($fh, $stringData);
$stringData = "</gallery>\n";
fwrite($fh, $stringData);
fclose($fh);
}
?>
and the data.xml:
<?xml version="1.0" encoding="ISO-8859-7" ?>
<gallery>
<photos>
<photo>
<thumb src="http://www.talkphp.com/images/thumb_Free_web_development_icon_set.jpg" />
<img src="http://www.talkphp.com/images/Free_web_development_icon_set.jpg" />
<caption text="yt4" />
<desc> <![CDATA[er]]> </desc>
</photo>
</photos>
</gallery>
how can i correct the code? i want the output result appear all the db records...
thank you
friendly