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
http://phpgrid.com/documentation/set_query_filterwhere/

$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
http://phpgrid.com/documentation/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: http://www.w3schools.com/sql/sql_view.asp

Feedback and Knowledge Base