I have a script that loads Customers/Addresses into Magento, but sometimes it fails. I would like to pick up were I left of (I am transforming data from one DB to Magento). What is a cheap way to get the last inserted customers email?

SELECT email FROM customer_entity ORDER BY entity_id DESC LIMIT 1; 

Is that a safe/sane way to do this?


You can get last inserted customer id by magento customer collection filter by entity_id desc

Step1: Load customer collection with sort by entity descending and by using setpagesize limt collection limit 1

$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*')

    /* get ;last customer $object by  $lastcst */

step2: get customer object getFirstItem(); which will provide fist item collection


Step3: get customer email


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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