Get table name with prefix magento

When writing database queries in modules for Magento it is often helpful to wrap the table names in a core function called “getTableName” this function will then prefix the table name if the install is using prefixes in the database.

$table = "catalog_product_entity_int"; // use your own table name $tableName = Mage::getSingleton("core/resource")->getTableName($table); // if a table prefix is defined than it will be added with the table name

Let me know your comment

0 comments:

Post a Comment