Magento query get records in table

0

Here is code query get records in table of Magento.
When you need debug or get anything but want not initialize a model and create a module.
Below code is all you need. You can set this code to /index.php or anywhere you want.

<?php

$resource = Mage::getSingleton('core/resource'); //get resource
$readConnection = $resource->getConnection('core_read'); //call read operation
//$writeConnection = $resource->getConnection('core_write'); //call write operation
$query = "SELECT * FROM core_resource where code LIKE '%khactung_setup%'"; //query string
$results = $readConnection->fetchAll($query); //run query string

//last, show result in array type
echo '<pre>';
var_dump($results);
echo '</pre>';

?>

About Author

Là một developer rất ham chơi nhưng không ham hố, không ham chơi nhưng rất thích cầm đầu...

Leave a Reply