Jump to content


[Solved] Add and Edit errors

set_relation_n_n add edit errors debugging

  • Please log in to reply
No replies to this topic

#1 voghDev

voghDev

    Member

  • Members
  • PipPip
  • 20 posts

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.







Also tagged with one or more of these keywords: set_relation_n_n, add, edit, errors, debugging

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users