🔥 Just Launched! Werra Premium Template for HyväSee it in Action

Learn the One Simple Method To Insert Record In Database In Magento

By Sanjay JethvaUpdated on May 22, 2025 1 min read

The popularity of Magento lies in its ability for customization and flexibility to fulfil the business requirements.

One such example below is the code to insert record in database in Magento.

It allows inserting a record in the table in Magento 1. For example, you created a table named “Test”. Now you want to insert record in that already created table.

Insert data in the table in Magento, easily, using the below solution:

Method to insert record in database in Magento:

$model = Mage::getModel('modulename/modelname');
$model->setData($yourData);
$model->save();

That’s it.

Please share the solution with Magento community via social media.

Thank you.

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.