Hello
Apologies if this has has been answered before, but is it possible to utilize a MySQL query to populate the grid columns rather than using a table?
If so, what is the code/syntax to implement this?
thank you
Tony
thanks Abu but I did not see what I was looking for in the link you posted. Perhaps I missed it.
I was wondering if the PHP file can be linked to a MySQL query already created in the backend rather than a table.
//connect to a query
// set database table for CRUD operations
$g->table = “somequery“; //?
_________________________________________
//instead of a table
// set database table for CRUD operations
$g->table = “clients”;
thanks
Tony
Pasting from docs:
By default, when we define the ->table property, it fetches all the possible columns of table. We can provide custom SQL query in ->select_command property to pick columns available for grid. We can use complex multi-join sub-queries in it.
$g->select_command = “SELECT i.id, invdate , c.name,
i.note, i.total, i.closed FROM invheader i
INNER JOIN clients c ON c.client_id = i.client_id”;