<?php
$dbhost ="localhost"; /*Veritabanı host adresi*/
$dbuser ="root"; /*veritabanı kullanıcı adı*/
$dbpass =""; /*veritabanı kullanıcı adı, localhost olduğu için boş*/
$dbadi ="xml"; /*oluşturduğumuz veritabanın adı*/
$baglanti=Mysql_Connect($dbhost, $dbuser, $dbpass);
if (!$baglanti) die ("Mysql Bağlantısı Başarısız");
mysql_select_db($dbadi,$baglanti) or die ("Veritabanı bağlantısı sağlanamadı");
?>
<!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 o.id, o.ad,o.soyad,o.tckimlik,c.cinsiyet FROM ogrenciler o LEFT OUTER JOIN cinsiyet c ON (o.cinsiyet_id=c.cinsiyet_id)");
while($arr=mysql_fetch_assoc($query))
{
$id = $arr['id'];
$ad = $arr['ad'];
$soyad = $arr['soyad'];
$tckimlik = $arr['tckimlik'];
$cinsiyet = $arr['cinsiyet'];
$ad = iconv("ISO-8859-9", "UTF-8", $ad);
$soyad = iconv("ISO-8859-9", "UTF-8", $soyad);
$yazi3 = "<ogrenci>
<id>$id</id>
<cinsiyet>$cinsiyet</cinsiyet>
<ad>$ad</ad>
<soyad>$soyad</soyad>
<tckimlik>$tckimlik</tckimlik>
</ogrenci>";
@$yazi2 = $yazi2.$yazi3;
}
$yazi = $yazi.$yazi2."</ogrenciler>";
fwrite($fp,$yazi);
?>
</body>
</html>ben denedim çalışıyor. Dener misiniz?
sorun olursa msn adresim :
sksndkz@gmail.com