gary
12/6/2018 - 10:59 AM

Magento 2 - Raw DB Query

Magento 2 - Raw DB Query

Magento 2 - Raw DB Query

<?php
//use a raw query to fid the row or rows
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();

$sql = " select * from `eav_attribute_option_swatch` where option_id in(".$option_img_id.") " ;
$result = $connection->fetchAll($sql);