2012-09-10 3 views
-1

에 추적 기능이서버 오류 MySQL의 오류 - 플렉스

public function matchingService() { 

    $stmt = mysqli_prepare($this->connection, " 
    INSERT INTO reusematching.matchedtable(user_idUser, productDetail_idProduct,Status,applyData) 
     SELECT waitinglist_user.user_idUser, 
       waitinglist_product.ProductDetail_idProduct, 
       productstatus,   
       waitinglist_user.waitinglistUser_applydata 
       FROM reusematching.waitinglist_user, 
       reusematching.waitinglist_product, 
       productinformation.productdetail, 
       productinformation.productstatus 
       where (waitinglistProduct_status = 1 
       and waitinglistUser_status = 1 
       and productCategroy_productCategroyID = waitinglistUser_applyProductType 
       and ProductDetail_idProduct = idProduct 
       and idStatus = waitinglistProduct_status); 

    SET SQL_SAFE_UPDATES=0; 

    DELETE FROM reusematching.waitinglist_user 
    WHERE Exists 
        (SELECT matchedtable.idMatchedTable 
         FROM reusematching.matchedtable 
         where matchedtable.user_iduser= waitinglist_user.user_idUser); 

    DELETE FROM reusematching.waitinglist_product 
    WHERE Exists 
        (SELECT matchedtable.idMatchedTable 
         FROM reusematching.matchedtable 
         where matchedtable.ProductDetail_idProduct 
           = waitinglist_product.ProductDetail_idProduct); 

    SET SQL_SAFE_UPDATES=1; 

    "); 

    $this->throwExceptionOnError(); 

    mysqli_stmt_execute($stmt); 
    $this->throwExceptionOnError(); 


    mysqli_stmt_free_result($stmt); 
    mysqli_close($this->connection); 


    return null; 
} 

작동하지 않습니다 1064 표시된 플렉스

서버 오류 MySQL의 오류

- 1064 : 당신은 당신의 SQL 구문에 오류가 있습니다; 근처에서 사용하는 올바른 구문은 MySQL 서버 버전에 해당하는 설명서를 확인 나는이 오류가 왜 라인 (18)

에서? 및 방법 '(matche을 선택 존재 reusematching.waitinglist_user 에서 삭제' 그것을 디버그하십시오.

+1

여기서는 PHP 코드 만 볼 수 있습니다. –

+0

나는이 서비스에 flex 스크립트를 사용했다. – Samuel

답변

0

PHP의 mysql 드라이버는 단일 query() 호출에서 여러 쿼리를 실행할 수 없습니다. 이것은 이전의 mysql 및 새로운 mysqli 함수 모두에 적용됩니다. SQL 인젝션 공격의 종류.

당신은 분할해야합니다. 귀하의 끔찍한 큰 쿼리 문을 여러 (더 작은) 개별 쿼리로 변환하십시오.

a) INSERT ... SELECT 
b) SET ... 
c) DELETE .. 
d) etc... 
+0

답변 해 주셔서 감사합니다. – Samuel