같은 파일인데 a사이트에서는 되는데, b사이트에서는 안되네요
도롱이
9년 전
조회 5,729
게시판 내용을 엑셀로 다운받는 소스입니다.
동일한 소스인데, 서버에 따라서 하나는 제대로 실행이 되고, 하나는 출력할 내역이 없습니다. 라고 나오네요ㅠ
무슨 이유일까요?..
고수님들 혹시... 해결할 수 있을까요?
아래는 소스입니다.
</p><p><?
include_once("./_common.php");
include_once("$g5[admin_path]/admin.lib.php");</p><p>
$sql_order = " order by wr_num, wr_reply ";</p><p> if ($sca || $stx)
{
$sql = " select distinct wr_parent from $write_table where $sql_search $sql_order ";
}
else
{
$sql = " select * from $write_table where wr_is_comment = 0 $sql_order ";
}</p><p> $result = sql_query($sql);
$cnt = @mysql_num_rows($result);
if (!$cnt)
alert("출력할 내역이 없습니다.");</p><p>
header('Content-Type: application/vnd.ms-excel');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Disposition: attachment; filename="list' . date("ymd", time()) . '.xls"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('content-transfer-encoding: binary');
echo "<html><head>";
echo "<meta http-equiv='Content-Type' content='application/vnd.ms-excel;charset=utf-8'>";
echo "</head><body>";
echo "<table border=1 style='font-family:돋움; font-size:10pt;'><tr height='30' bgcolor='#99CCFF'>";
echo "<td align=center>번호</td><td align=center>등록날짜</td><td align=center>접수상태</td><td align=center>신청자</td><td align=center>일정</td><td align=center>교회명</td><td align=center>직분</td><td align=center>입금자명</td><td align=center>제목</td><td align=center>휴대폰</td><td align=center>하실말씀</td></tr>\n";
function get_encfilename($bo_table, $wr_id, $order=0) { //파일명 출력함수
global $g5;
$sql = "select bf_file from `$g5[board_file_table]` where bo_table='$bo_table' AND wr_id='$wr_id' order by bf_no LIMIT $order, 1";
$temp = sql_fetch($sql);
return $temp[bf_file];
}</p><p> for ($i=0; $row=mysql_fetch_array($result); $i++)
{
echo "<tr height=55>\n";
echo "<td align=center>" . $row[wr_id] . "</td>\n"; //번호
//echo "<td align=center>" . $row[mb_id] . "</td>\n";
echo "<td align=center>" . $row[wr_datetime] . "</td>\n"; //날짜
echo "<td align=center>" . $row[wr_8] . "</td>\n"; //접수상태
echo "<td align=center>" . $row[wr_name] . "</td>\n"; //신청인
echo "<td align=center>" . $row[ca_name] . "</td>\n"; //일정
echo "<td align=center>" . $row[wr_4] . "</td>\n"; //교회명
echo "<td align=center>" . $row[wr_1] . "</td>\n"; //직분
echo "<td align=center>" . $row[wr_2] . "</td>\n"; //입금자명
echo "<td align=center>" . $row[wr_subject] ."</td>\n"; //제목
echo "<td align=center>" . $row[wr_3] . "</td>\n"; //휴대폰
echo "<td align=center>" . $row[wr_6] . "</td>\n"; //하실말씀</p><p> //echo "<td align=center>" . $row[wr_homepage] . "</td>\n";
//echo "<td align=center>" . $row[wr_link1] . "</td>\n";
//echo "<td align=center>" . $row[wr_link2] . "</td>\n";</p><p> //echo "<td align=left>" . $row[wr_content] . "</td>\n"; //하실말씀</p><p>
</p><p> echo "</tr>\n";
}
echo "</table>";
echo "</body></html>";
if ($i == 0)
alert("자료가 없습니다.");</p><p> exit;</p><p>?></p><p>
댓글을 작성하려면 로그인이 필요합니다.
답변 3개
댓글을 작성하려면 로그인이 필요합니다.
9년 전
출력한 내용이 없습니다 라고 뜬다면 쿼리돌렸을때에
일치하는 게시판의 글이 한개도 없다는 말이니깐
안된다는 게시판에 글이있는게 맞나요?
맞으면 쿼리문을 한번 echo $sql; 로 찍어보세요
어떻게 나오는지
echo $sql;
|
15 | $cnt = @mysql_num_rows($result); |
16 | if (!$cnt) |
17 | alert("출력할 내역이 없습니다."); |
그리고 if ($sca || $stx)
여기 부분위에 echo $sca; echo $stx;
값이 없어서 sql문이 실행이 안되는지도 보셔야겟네요
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
�
도롱이
9년 전
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
sca, stx 값이 없어도 그 아래 퀴리가 실행되어 cnt값이 들어와야 하는데...
[code] if (!$cnt)
alert("출력할 내역이 없습니다.");[/code]
요 부분을 주석처리하면 엑셀파일이 생성되는데 문제는 내용이 없네요..
cnt값이 안들어오네요.. 퀴리 구문에 문제가 있는걸까요? 문제가 있으면, 다른 사이트에도 안되야 되는데... 도무지 이유를 모르겠네요...