How get a value from mysql in prestashop?

时间:2017-08-05 11:07:13

标签: mysql prestashop prestashop-1.6

I want to get a value from a table like that:

SELECT id_image FROM `ps_image` WHERE id_product = 903 limit 1

How can i integrate this sql command in prestashop?

1 个答案:

答案 0 :(得分:1)

$product_id = '903';

$query = Db:: getInstance()->getRow(
'SELECT id_image FROM '._ DB_PREFIX_.'image WHERE id_product ='. $product_id
);

使用$ query变量获取图像的id。