Magento Engineer
social
Magento2

Magento2

The industry's top wizards and other experts share their advice and research findings.

How to run custom MySql query in Magento2 and fetch data?

<?php

//Connection with magento2 database

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection('core_read');

//Now execute your mysql query

$fetch="SELECT * FROM catalog_product_entity";

$result = $connection->fetchAll($fetch);

?>

Ad comes here
Error's and solution's
Update Cookies Preferences