최신글 추출하는 latest 함수 질문입니다. 정보
최신글 추출하는 latest 함수 질문입니다.본문
어느 페이지에서 게시판 최신글을 추출하여 보여주려 합니다.
<? php
include_once("./board/lib/latest.lib.php");
echo latest("", "policy", 4, 70);
?>
이렇게 사용을 하는데
select * from where bo_table = 'policy'
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 bo_table = 'policy'' at line 1
error file : /index.php/service/government
이런 에러메세지만 출력이 됩니다.
<? php
echo $g4[board_table];
include_once("./board/lib/latest.lib.php");
echo latest("", "policy", 4, 70);
?>
해서 확인해보니 g4_board 라는 메세지가 찍히는 것을 확인했고
board/lib/latest.lib.php 파일에서 function latest() 전에
echo $g4[board_table]; 를 찍어보면 g4_board가 제대로 출력이 되는데
fucntion latest() 내부에서 echo $g4[board_table];를 써보면
아무것도 찍히지 않습니다.
global $g4; 이전에 찍어봐도 그렇고 이후에도 마찬가지고요.
board/config.php 에서 정의된 $g4 상수가
latest() 함수 내부에서는 작동을 하지 않는것 같은데 제가 생각한 것이 맞는건가요?
간단하게 요약하자면
lib/latest.lib.php 파일에서는 config.php 에서 정의한 상수가 적용이 되었는데
latest.lib.php 파일에 있는 latest() 함수 내에서는 config.php에서 정의한 상수가 적용이 되지 않는다고 의심된다.
라는 상황입니다... 뭐가 문제인 걸까요....
<? php
include_once("./board/lib/latest.lib.php");
echo latest("", "policy", 4, 70);
?>
이렇게 사용을 하는데
select * from where bo_table = 'policy'
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 bo_table = 'policy'' at line 1
error file : /index.php/service/government
이런 에러메세지만 출력이 됩니다.
<? php
echo $g4[board_table];
include_once("./board/lib/latest.lib.php");
echo latest("", "policy", 4, 70);
?>
해서 확인해보니 g4_board 라는 메세지가 찍히는 것을 확인했고
board/lib/latest.lib.php 파일에서 function latest() 전에
echo $g4[board_table]; 를 찍어보면 g4_board가 제대로 출력이 되는데
fucntion latest() 내부에서 echo $g4[board_table];를 써보면
아무것도 찍히지 않습니다.
global $g4; 이전에 찍어봐도 그렇고 이후에도 마찬가지고요.
board/config.php 에서 정의된 $g4 상수가
latest() 함수 내부에서는 작동을 하지 않는것 같은데 제가 생각한 것이 맞는건가요?
간단하게 요약하자면
lib/latest.lib.php 파일에서는 config.php 에서 정의한 상수가 적용이 되었는데
latest.lib.php 파일에 있는 latest() 함수 내에서는 config.php에서 정의한 상수가 적용이 되지 않는다고 의심된다.
라는 상황입니다... 뭐가 문제인 걸까요....
( select a.* , ( select sum(co_count) as co_count from g4_qa_choose where mb_id=a.mb_id and bo_table = 'g4_qa' ) as q_co_count from `g4_write_g4_qa` a where wr_parent = '246175' and wr_8 != '' and wr_is_comment = 1 and CONVERT(wr_7, UNSIGNED) >= 5 group by wr_content having max(wr_7) order by CONVERT(wr_7, UNSIGNED) desc limit 3 )
1055 : Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sir.a.wr_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
error file : /15sir/bbs/board.php