validate save code for importing csv file


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // $error = false;
  2.  
  3. // validate the row
  4. // $this->set($data);
  5. // if (!$this->Member->validates())
  6. // {
  7. // $this->_flash(__(sprintf('Post for Row %d failed to validate.',$i), true),'warning');
  8. // $error = true;
  9. // }
  10.  
  11. // save the row
  12. // if (!$error && !$this->Member->save($data))
  13. // {
  14. // $this->Member->_flash(__(sprintf('Post for Row %d failed to save.',$i), true),'warning');
  15. // }
  16.  
  17. // save the row
  18. // if (!$error)
  19. // {
  20. // // for more info on _flash() please visit:
  21. // // http://mrphp.com.au/node/1820
  22. // $this->Member->_flash(__(sprintf('Post for Row %d was saved.',$i), true),'success');
  23. // }
  24.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.