When I create a new item, it logs the id now to the "itemstock" table correctly...BUT, now I get an error if I do an "edit/update":
Notice: Undefined index: id in php/lib/Editor/Editor.php on line 523
{"error":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '48' for key 'PRIMARY'"}
Am I using the wrong syntax to detect a newly created record?
I have THREE buttons above the Datatable : "New" "Edit" "Add Quantity".
The new and edit are normal modal boxes to add and update. The Add Quantity is a custom button that only allows quantities to be added.
The NEW and ADD QUANTITY work fine but the EDIT throws the error.
The ADD QUANTITY uses the "stockEditor" function to add more quantity.
Answers
Hi Allan, almost there...
So, I put the following code :
When I create a new item, it logs the id now to the "itemstock" table correctly...BUT, now I get an error if I do an "edit/update":
Am I using the wrong syntax to detect a newly created record?
Basically it's now working EXCEPT when I do an EDIT/UPDATE I get the error in my previous comment.
Here is my PHP file:
} );
}(jQuery));
```
Here is my JS file:
I have THREE buttons above the Datatable : "New" "Edit" "Add Quantity".
The new and edit are normal modal boxes to add and update. The Add Quantity is a custom button that only allows quantities to be added.
The NEW and ADD QUANTITY work fine but the EDIT throws the error.
The ADD QUANTITY uses the "stockEditor" function to add more quantity.
```
/*
* Editor client script for DB table table_products
* Created by http://editor.datatables.net/generator
*/
var editor; // use a global for the submit and return data rendering in the examples
(function($){
$(document).ready(function() {
I have resolved it now by creating a custom UPDATE button.
Thanks for all your help.
Hi,
Good to hear you've got it working now!
Allan