Skip to content

CRUD (Create, Remove, Update, Delete) Not Working

Another common issue for CRUD not working is caused by using a complex SQL statement in the constructor. 

Keep in mind that, in your constructor, Only a simply SQL SELECT statement should be used. Do NOT use other SQL verbs such as JOIN, UNION, WHERE, GROUP etc. 

For 'WHERE' clause, please use set_query_filter method instead

$dg = new C_DataGrid("SELECT * FROM company", "companyID", "company");
$dg->set_query_filter("where parentID = ".$user['companyID_fk']);

For 'GROUP' clause, please use set_group_summary

For JOIN, UNION, and other SQL verbs, it is recommended to create a SQL view, then use the view as if it's a SQL table in your grid. More about SQL view:

Feedback and Knowledge Base