Extra Form
PHP PHP 8.1
CMS Rhymix 2.x

<query id="getBmg" action="select">
    <tables>
        <table name="bmg_other" />
    </tables>
    <conditions>
        <condition operation="equal" column="target_srl" var="target_srl" filter="number" pipe="and"/>
        <conditoin operation="equal" column="document_srl" var="document_srl" filter="number" pipe="and"/>    
    </conditions>
</query>
 

위와 같이 xml 쿼리문을 작성했습니다. pipe  조건절을 통해 target_srl 과 document_srl이 모두 만족해야 결과를 도출해내도록 했구요

 

        $args->target_srl = abs($logged_info->member_srl); // 현재 댓글을 작성하려는 작성자의 member_srl
        $args->document_srl = $obj->document_srl; // 현재 댓글을 작성하려는 글 번호
        $output_i = executeQueryArray('bmg.getBmg', $args); // 내가 차단을 당했나요?
        
        if($output_i->data){        
            return new BaseObject(-1, '쿼리 만족 결과 찾음!');    
        }

 

위는 모듈 코드입니다.

target_srl와 document_srl을 args에 넣어주고 쿼리문을 날렸는데, 

현재 DB에는 완벽히 일치하는 데이터가 없음에도 불구하고   if($output_i->data) 내부에 들어가있는게 실행이되네요...

쿼리시 결과가 없을때만 해당 조건을 실행하게 하고싶은데 혹시 제가 잘못 작성한 부분이 있을까요?

  • profile
    $output_i->data 의 유무나 값이 아닌 count를 확인해야 하지 않을까요???
  • profile profile
    바꾸어 봐도 작동을 안하네요... 한시간째 붙잡고 있는 중입니다 ㅠㅠ
  • profile profile
    $output_i->data 디버그로 찍어보세요.
  • profile

    debugPrint($output_i) 이렇게 하면 해당 부분에 어떤 에러가 뜨는지 에러문구를 확인할 수 있습니다.

    의심되는 부분은 <condition operation="equal" column="target_srl" var="target_srl" filter="number" pipe="and"/> 첫 부분 pipe는 필요가 없습니다. 지워주세요

  • profile

    1. 받아오려는 컬럼을 선언하지 않았네요.

    2. 라이믹스 2.0 기준, AND 조건으로만 연결한다면 pipe 속성은 필요하지 않습니다. 넣는다고 손해보지는 않습니다.

    3. 마지막 속성과 닫는 태그(/>) 사이를 한 칸 띄어 주세요.

    4. $output_i를 디버그 찍어보시면 실제로 어떤 쿼리가 실행되었는지 알 수 있습니다.

  • profile profile
    이상하네요... 쿼리결과 부터가 이상하게 나옵니다.
    두 조건을 모두만족해야 쿼리가 나와야할텐데 하나의 조건이라도 만족하면 바로 커리 결과가 나오네요

    <query id="getBmg" action="select">
    <tables>
    <table name="bmg_other" />
    </tables>
    <columns>
    <column name="block_srl" />
    </columns>
    <conditions>
    <condition operation="equal" column="target_srl" var="target_srl" filter="number" notnull="notnull" />
    <conditoin operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" pipe="and" />
    </conditions>
    </query>

    로 수정은 했습니다 ㅠㅠ
  • profile
    하..이제 찾았습니다. 세시간 동안 고민해본 결과입니다.
    conditoin -> condition 오타이군요...