Php

Php

Ad comes here
Ad comes here
Ad comes here
Ad comes here
Ad comes here
Ad comes here

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

//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
Ad comes here
Ad comes here
Ad comes here
Error's and solution's