Skip to main content
4 of 6
edited body
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Also Issue in inheriatge class of

in Model/Mysql4/Modulename.php

Mage_Core_Model_Mysql4_Collection_Abstract 

to

Mage_Core_Model_Mysql4_Abstract

How to create database module:http://www.amitbera.com/create-an-magento-extension-with-custom-database-table/

Try This

$Collection=Mage::getModel('module/model')->getCollection()->addFieldToFilter('customer_id',$customerId)->addFieldToSelect('*')->setOrder('order_id',DESC);

$collection give array of Record of customer Id

for get one item try this

$Collection->getFirstItem();
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239