Opecart中相同查询的不同值

时间:2016-11-21 09:59:32

标签: php mysql opencart php-7

我正在使用 Opencart 1.5 ,我正在使用localhost。在产品表中,我添加了三个新列:

`review_status` TINYINT(4) NOT NULL DEFAULT '0'
`lock_edit_view` TINYINT(4) NOT NULL DEFAULT '0'
`reviewed_by_admin` TINYINT(4) NOT NULL DEFAULT '0'

当我从 PHPMyAdmin 运行数据库查询时,它显示了值:

查询:

SELECT product_id, review_status, reviewed_by_admin, lock_edit_view
FROM oc_product where product_id IN (1,2,3,4)

结果:

product_id   review_status      reviewed_by_admin   lock_edit_view  
    1               1                   1                   1
    2               1                   1                   1
    3               1                   1                   1
    4               1                   1                   1

但是当我在 Opencart 上查询时,它显示了不同的值:

模型查询:

public function getProductsByProductIds($data = array())
{
    $sql = "SELECT product_id, review_status, reviewed_by_admin, lock_edit_view FROM oc_product where product_id IN (1,2,3,4)";
    $query = $this->db->query($sql);
    return $query->rows;
}

结果:

Array
(
    [0] => Array
        (
            [product_id] => 1
            [review_status] => 0
            [lock_edit_view] => 0
            [reviewed_by_admin] => 0
        )
    [1] => Array
        (
            [product_id] => 2
            [review_status] => 0
            [lock_edit_view] => 0
            [reviewed_by_admin] => 0
        )
    [2] => Array
        (
            [product_id] => 3
            [review_status] => 0
            [lock_edit_view] => 0
            [reviewed_by_admin] => 0
        )
    [3] => Array
        (
            [product_id] => 4
            [review_status] => 0
            [lock_edit_view] => 0
            [reviewed_by_admin] => 0
        )   
)

我不知道它是如何向我展示同一查询的不同值。

0 个答案:

没有答案