XML Dosyası oluşturma

Örnek xml dosyası oluşturma. Bu örnekte türkçe karekter problemleri çözülmüştür.


<?php
include("config.php");
dbbaglan();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>XML Oluştur</title>
</head>

<body>
<?php
$fp = fopen("veriler.xml",'r+');
$yazi = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ogrenciler>";
$query = mysql_query("select * from ogrenciler");
while($arr=mysql_fetch_assoc($query))
{
$ad = $arr['ad'];
$soyad = $arr['soyad'];
$tckimlik = $arr['tckimlik'];
$ad = iconv("ISO-8859-9", "UTF-8", $ad);
$soyad = iconv("ISO-8859-9", "UTF-8", $soyad);
$yazi3 = "<ogrenci>
 <ad>$ad</ad>
 <soyad>$soyad</soyad>
 <tckimlik>$tckimlik</tckimlik>
 </ogrenci>";
@$yazi2 = $yazi2.$yazi3;
}
$yazi = $yazi.$yazi2."</ogrenciler>";
fwrite($fp,$yazi);
?>
</body>
</html>


Twitter Digg Delicious Stumbleupon Technorati Facebook
Yazar :

PHP Programcısı

http://www.tasarimrehberi.com

1 Yorum “XML Dosyası oluşturma”

  1. elin sağlık güzel paylaşım