An error in this code, for exporting it to excel. If not use line 1 and 2 code is working perfectly. If use line 1 and line 2 code it's working but don't export to excel
, redirect to PHP control page. Also can see result there its normal. Where is the problem?
$servis_listesi = mysql_query("SELECT * from servis_listesi");
while($tumservisler = mysql_fetch_array($servis_listesi)){
$ad_servis = $tumservisler["servis_adi"];
$kod_servis = $tumservisler["servis_kodu"];
$servisil = $tumservisler["servis_il"]; // line 1
$servisilce = $tumservisler["servis_ilce"]; // line 2
$ortalamasi = mysql_query("select avg(anket_puani),COUNT(anket_puani) from anket_sonuclar where servis_kodu='".$kod_servis."' and anket_tarihi between '".$tarih1."' and '".$tarih2."'");
$bicimle = mysql_fetch_array($ortalamasi);
$sonuc_reel = $bicimle["avg(anket_puani)"];
$sonuc_sayi = $bicimle["COUNT(anket_puani)"];
$sonuc_net = round($sonuc_reel,2);
echo '<tr>
<td>'.$kod_servis.'</td>
<td>'.$ad_servis.'</td>
<td>'.$servisil.'</td> <!-- line 1 want to use here-->
<td>'.$servisilce.'</td><!-- line 2 want to use here-->
<td>'.$sonuc_sayi.'</td>
<th></th>
<td>'.$sonuc_net.'</td>
</tr>';
};
header("Content-Type: application/vnd.ms-excel");header('Content-Type: text/html; charset=utf-8');header("Content-disposition: attachment;filename='anket_list ".date('d.m.Y').".xls");
Hi Mahir if it is possible please try the give code below and check once. $tumservisler = mysql_fetch_array($servis_listesi); while($tumservisler){
}
Error is solved. I used the previous header
s that is all. Thanks.