我调试了所有内容,返回 500错误的原因来自此部分:
for($k=0;$k<=$i;$k++)
{
$crr_id=$field1['TestId'][$k];
$sql2="SELECT Frontname FROM apply.StudentsInfo WHERE TestId='$crr_id'";
$query2=mssql_query($sql2);
while( $row2 = mssql_fetch_assoc($query2)){
$row2['Frontname']=iconv("windows-874","utf-8", $row2['Frontname']);
echo $row2['Frontname'];
if($row2['Frontname']==iconv("windows-874","utf-8", "เด็กชาย")
|| $row2['Frontname']==iconv("windows-874","utf-8", "นาย"))
{
$male++;
}
else if($row2['Frontname']==iconv("windows-874","utf-8", "เด็กหญิง")
|| $row2['Frontname']==iconv("windows-874","utf-8", "นางสาว"))
{
$female++;
}
}
mssql_free_result($query2);
}
问题是PHP从 MS SQL 获取数据(通过尝试回复它来接收数据)并转到if-else
语句。出于某些原因,它拒绝了自己。
我尝试过的解决方案:删除所有iconv()
个功能。但不起作用。