gpt4 book ai didi

php - 从 PHP 导出 有趣的错误

转载 作者:行者123 更新时间:2023-11-29 19:21:16 24 4
gpt4 key购买 nike

此代码在将其导出到 Excel 时出现错误。如果不使用第 1 行和第 2 行代码,则可以正常工作。如果使用第 1 行和第 2 行代码,它可以工作,但不导出到 Excel,重定向到 PHP 控制页面。也可以看到结果,这很正常。问题出在哪里?

    $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");

最佳答案

嗨,Mahir,如果可能,请尝试提供下面的代码并检查一次。$tumservisler = mysql_fetch_array($servis_listesi);while($tumservisler){

}

关于php - 从 PHP 导出 有趣的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42432656/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com