2

I need to add some checks on database all tables for this want to get all tables name which are exist in database.

Is there any way to get all tables name from database in magento1.9?

1 Answer 1

2
$connection = Mage::getModel('core/resource')->getConnection('core_read');
$sql = 'SELECT TABLE_NAME 
        FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_TYPE = "BASE TABLE" AND TABLE_SCHEMA="magento1" '; //your db name
$names = $connection->fetchAll($sql);
Mage::log($names, null, "db.log");

Try this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.