0

How to check weather the value is in database when i insert the dataValue repeatedly save to database

$amount_model = Mage::getModel('donations/amount');
if(isset($post_data['amount']) && $post_data['amount'] != '')
{
    $amountdata = $post_data['amount'];
    foreach(array_unique($amountdata) as $amount) {
        $amount['donation_id'] = $dataid;
        $amount_model->setData($amount);
        $amount_model->save();
    }
}
  • share the code which you try for the save? – Dhiren Vasoya Oct 2 at 14:00
  • Your code is not clear, if you want to save the values just once example 5 one time in your database, you have to get all values before then you check if the new value is not available in database, you insert it. – PЯINCƏ Oct 2 at 23:37
  • How to get value all values first – Raji Oct 3 at 5:42

Your Answer

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

Browse other questions tagged or ask your own question.