⚠ 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

[Solved] Add and Edit errors



voghDev
  • profile picture
  • Member

Posted 21 May 2014 - 11:37 AM

I have two tables, and a set_relation_n_n beetween them:

 

 

Museum: id, name, ...

Category: id, name, ...

Museum_x_Category: museum_id, category_id

The relation is defined by this line:

 

 

$crud->set_relation_n_n('Categorías', 'Museum_x_Category', 'Category', 'museum_id', 'category_id', 'name', 'category_id' );

 

I was getting these "An error ocurred on insert" and "An error has occurred on saving." errors when adding or editing.

 

The cause was: the non-utf8 character in the word 'Categorías'. Replacing this word by 'Categorias' (note the í), it works.

 

Also, i had to remove the last parameter 'category_id', because it was assigning me all the museums to the first category (id=1). Gotta do some research to understand this behavior of GroceryCRUD. Probably it is correct.

 

So now, it works.

 

Hope my solutions save time to anybody else.