⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to catch mysql_error() or mysql_errno()



tabarry
  • profile picture
  • Member

Posted 30 January 2013 - 13:12 PM

I would like to validate unique fields in database at form submission by catching mysql_errno() instead of using the is_unique function. Can anyone help how can I do this.


Please provide details like if mysql returns error, I should be able to display the error on the form, just like other validation errors or is_unique error.

Thanks

davidoster
  • profile picture
  • Member

Posted 31 January 2013 - 00:27 AM

I think you need to extend the default grocery_crud model and there check for any errors you want.
Check here: http://www.grocerycr...tions/set_model