⚠ 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

set_relation wrong primary key value inserted



Pure Creative
  • profile picture
  • Member

Posted 18 June 2014 - 10:36 AM

I am using set_relation to fetch a primary key from a table entitled 'tree'.

 

The dropdown displays the 'id' and 'title' information exactly as I was expecting.

 

When I select an entry from the dropdown the correct data is shown in the field.

 

When I save the entry the wrong data is sent to the database. It is always the same id number no matter which entry I choose in the dropdown.

 

PHP code:

 

$this->grocery_crud->set_relation('linked','tree','{id} ( {title} )');

 


Pure Creative
  • profile picture
  • Member

Posted 18 June 2014 - 12:51 PM

I've tested further and this problem only occurs when the primary key id to be inserted is 1000 or more. IDs with 999 or less are inserted correctly.


Pure Creative
  • profile picture
  • Member

Posted 18 June 2014 - 12:54 PM

Sorry marked this as solved. The field I had set up in MySQL was in format TinyInt which has a limit of 127.