Hi,
I wondering if it is possible to use in sql statement something like this (or how to do this):
in first grid:
$grid[“detail_grid_id”] = “list2”;
$grid[“subgridparams”] = “comanda”;
in second grid:
$comanda = $_GET[“comanda”];
….
$col = array();
$col[“title”] = “Denumire piesa”;
$col[“name”] = “denumire_piesa”;
$col[“width”] = “150”;
$col[“formatter”] = “autocomplete”;
$col[“formatoptions”] = array(“sql”=>”SELECT DISTINCT denumire_piesa as k, denumire_piesa as v FROM piese_tot_comanda_croi where comanda=$comanda“);
$col[“export”] = true;
$col[“editable”] = true;
$col[“editoptions”] = array(“autocomplete”=>”off”,”list”=>”autocompleteOff”);
$col[“editrules”][“required”] = true;
$col[“formatoptions”][“op”] = “bw”;
$cols_d[] = $col;
In this way I get : 500 : Internal Server Error. Status: error
in browser debugger: Couldn’t execute query. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘AND denumire_piesa like ‘d%” at line 1 – SELECT DISTINCT denumire_piesa as k, denumire_piesa as v FROM piese_tot_comanda_croi where comanda= AND denumire_piesa like ‘d%’
I appreciate any help!
Hi,
When the subgrid initially loads, there is no value passed in $_GET so that case is not handled here.
You can replace $_GET data fetch with following.
$comanda = !isset($_GET[“comanda”]) ? 0 : $_GET[“comanda”];