줌

쿼리 오류 어떤 부분이 문제인지 찾을 수가 없네요

안녕하세요.
오전에 DB와 DATA를 롤백하고 링크를 모두 확인 했습니다. 모두 정상 적으로 작동 하더군요
그런데 조금전부터 투표관련 페이지만 오류가 납니다.
파일을 만지지 않았는데 갑자기 생긴 오류라 백업 받았던 파일을 다시 올렸는데도 오류 메세지를 봐도 정확히 뭐가 문제인지 알수가 없네요 도움 부탁드립니다.

<?
include_once("./_common.php");
include_once("$g4[path]/head.sub.php");


//if ($member[mb_id]) {

$sql_common = " from $g4[member_poll_table] ";

$sql_search = " where (2) ";
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
default :
$sql_search .= " ($sfl like '%$stx%') ";
break;
}
$sql_search .= " ) ";
}

if (!$sst) {
$sst = "po_id";
$sod = "desc";
}


$sql_order = " order by $sst $sod ";

$sql = " select count(*) as cnt
$sql_common
$sql_search
$sql_order ";
$row = sql_fetch($sql);

$total_count = $row[cnt];

$rows = $config[cf_page_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함

$sql = " select *
$sql_common
$sql_search
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);

$listall = "<a href='$_SERVER[PHP_SELF]' class=tt>처음</a>";

$g4[title] = "투표관리";
//include_once("./admin.head.php");

$colspan = 6;
?>
<?
include_once("$g4[path]/new_head2.php");


if (!$skin_dir) $skin_dir = "member_poll";
$poll_skin_path = "$g4[path]/skin/poll/$skin_dir";
include_once ("$poll_skin_path/poll_list.skin.php");

include_once("$g4[path]/new_tail.php");

// }
// else {
// alert("글을 읽을 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", "./login.php?wr_id=$wr_id{$qstr}&url=".urlencode("$g4[path]/bbs/member_poll_list.php"));
// }
?>
<?
include_once("$g4[path]/tail.sub.php");
//include_once ("./admin.tail.php");

?>



오류내용

select count(*) as cnt from where (2) order by po_id desc

1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where (2) order by po_id desc' at line 3
|

댓글 2개

아래부분의 $g4[member_poll_table] 가 나오지 않는데 확인해보셔요.
원래라면... $g4['poll_table'] 라고 작성되어야 하지 않는가요?

$sql_common = " from $g4[member_poll_table] ";
------------------------비정상------------------------------
select count(*) as cnt from where (2) order by po_id desc
--------------------------정상-------------------------------
select count(*) as cnt from g4_poll where (2) order by po_id desc
미니어스님 답변 감사합니다. 원인은 config파일에 있었습니다.
member_poll테이블을 추가했었는데 그부분이 빠져있었습니다. 해결했습니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
11-02-24 조회 1,738
11-02-24 조회 1,813
11-02-24 조회 2,647
11-02-23 조회 1,539
11-02-23 조회 1,471
11-02-23 조회 1,574
11-02-23 조회 1,767
11-02-23 조회 2,662
11-02-23 조회 2,552
11-02-23 조회 1,637
11-02-23 조회 1,865
11-02-23 조회 2,986
11-02-23 조회 1,890
11-02-23 조회 1,092
11-02-23 조회 1,646
11-02-23 조회 1,852
11-02-23 조회 2,202
11-02-23 조회 1,055
11-02-23 조회 1,629
11-02-23 조회 1,904