为什么PDO DELETE-查询不起作用?

时间:2016-06-28 07:34:56

标签: php mysql sql pdo

我尝试用JOIN删除几张表中的记录,但我的pdo查询不起作用,我不明白为什么? 。请告诉我,我做错了什么

public function clear()
{

    try {

        $rows = $this->pdo->prepare("
                    DELETE p,ptc,pts,pd
                    FROM `product`  as p
                    LEFT JOIN `product_to_category` as ptc using(product_id)
                    LEFT JOIN `product_to_store` as pts using(product_id)
                    LEFT JOIN `product_description` as pd using(product_id)
                    WHERE p.isImport is true and ptc.category_id =1126
                    ");
        $rows->execute();

        if(file_exists(DIR_ADMIN.'added.txt'))
        {
            unlink(DIR_ADMIN.'added.txt');
        }

    } catch (Exception $ex) {
        echo $ex->getMessage();
    }

}

0 个答案:

没有答案