Hi again, hoping you can point me in the right direction.
When I put a post variable in my where clause the grid fails. When I hardcode the value of the post variable it runs fine. Including the select command here to see if you can find any issues.
$g->select_command = ”
select
employee_sak,
‘Roles’ as ‘Section’,
role_name as ‘ID’,
role_descr as ‘Details’
from
roles
inner join role_types
on roles.role_type_sak = role_types.role_type_sak
where
employee_sak = “.$_POST[’employee_sak’].”
UNION
select
employee_sak,
‘Vehicles’ as ‘Section’,
vehicle_id as ‘ID’,
type as ‘Details’
from
vehicles v
inner join employee_vehicle_link evl
on v.vehicle_sak = evl.vehicle_sak
where
employee_sak = “.$_POST[’employee_sak’].”
UNION
select
employee_sak,
‘Routes’ as ‘Section’,
route_number as ‘ID’,
route_name as ‘Details’
from
routes r
inner join vehicle_route_link vrl
on r.routes_sak = vrl.route_sak
inner JOIN employee_vehicle_link evl
on vrl.vehicle_sak = evl.vehicle_sak
where
employee_sak = “.$_POST[’employee_sak’];
Ok so apparently we need to set a session variable for it? Why is this necessary?
I got this to work.
if (!empty($_POST[’employee_sak’]))
{
$_SESSION[‘ep_employee_sak’] = $_POST[’employee_sak’];
}
$ep_employee_sak = $_SESSION[‘ep_employee_sak’];
Yes, this is required. Complete reason and workflow is mentioned in docs:
https://www.gridphp.com/docs/misc-faqs/#q-how-to-load-grid-based-on-_post-data-from-other-page