Only create record fail
Only create record fail
Hi,
The code below can successfully update and delete records but fail at create record
XHR return :
Fatal error: Call to a member function insertId() on null in C:\data\demo\libs\datatables\media\php\Editor\Editor.php on line 1381
http://debug.datatables.net/ivuwir
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
if ( $_SESSION[$website["appname"]]["menuCategoryId"]!="" ) {
Editor::inst( $db, 'menuItem','menuItemId' )
->fields(
Field::inst( 'menuItem.description' )
->validator( 'Validate::notEmpty' ),
Field::inst( 'menuItem.page' ),
Field::inst( 'menuItem.icon' ),
Field::inst( 'menuItem.path' ),
Field::inst( 'menuItem.menuCategoryId' )
->options("menuCategory","menuCategoryId","menuCategory.description"),
Field::inst( 'menuCategory.description' ),
Field::inst( 'menuItem.dorder' )
)
->leftJoin("menuCategory","menuCategory.menuCategoryId","=","menuItem.menuCategoryId")
->where("menuItem.menuCategoryId",$_SESSION[$website["appname"]]["menuCategoryId"],"=")
->process( $_POST )
->json();
} else {
$return["data"] = array();
echo json_encode($return);
}
Please help, thx.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
Does the newly inserted row meet the
where
condition that you have applied? i.e. ismenuItem.menuCategoryId
the same as the session variable?Does the row actually get edited in the database (you can refresh the page to see if it is updated).
Allan