문서 : UTF-8 (BOM 없음)
에러
"Object Object ( [error] => 1064 [message] => You have an error in your SQL syntax;
check the manual that corresponds to your MariaDB server version for the right syntax to use near
'? `parent_srl` = ?' at line 1 [variables] => Array
( [_query] => SELECT * FROM `xe_document_categories` as `document_categories`
WHERE `module_srl` = ? `parent_srl` = ? [_elapsed_time] => 0.00020 ) [httpStatusCode] => )
XML 쿼리
<query id="getSubCategory" action="select">
<tables>
<table name="document_categories" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" />
<condition operation="equal" column="parent_srl" var="parent_srl" filter="number" />
</conditions>
</query>
쿼리
$args = new StdClass();
$args->module_srl = 137;
$args->parent_srl = 3834;
$output = executeQuery('document.getSubCategory',$args);
XE를 쓰니 쌍욕이 나오네요.
댓글 18
두번째 cond에 pipe가 누락되어 있습니다.
https://github.com/xpressengine/xe-tutorial/tree/master/XML_Query/06_select_query_with_where#pipe-속성---다중-where절
XE로 개발하실생각 있으신분 있으시면 되도록 XE는 피하시길, 라이믹스는 잘되는지 모르겠네요.
문법 오류로 잘못하신것 같은데요.
<condition operation="equal" column="parent_srl" var="parent_srl" filter="number" />
를
<condition operation="equal" column="parent_srl" var="parent_srl" filter="number" pipe="and" />
로 고치시라구요. 그리고 네비게이션은 어디갔나요? 네비게이션도 가급적이면 설정을 하는게 좋습니다. 제대로 만들지도 않아놓고 XE탓을 하면 어떡합니까?
navigation은 기본으로 들어있는 쿼리 XML 파일에도 안붙어있는데 네이버도 잘못짜고있네요?
누가 쓰지도 않는데 붙일 생각을 합니까?
많은 쿼리를 하지 않는 구간(카테고리리스트와같은) 에서는 안붙여도 무관합니다.
다만 list를 사용하는 구간에서 붙이죠.