I’m seeing posts that dance around this topic, but don’t seem to address it directly. Some clarification would be appreciated.
I’d like to pass variables on the address bar to a Grid Application, so only records meeting the criteria of the variable provided are displayed.
For instance, if the SQL for the data for the grid looks like this:
SELECT location_id, location_active, location_name FROM locations
I get a list of all the customer locations.
But if I only want a list of the locations for a given customer:
SELECT location_id, location_active, location_name FROM locations WHERE customer_id=5
Is there a way to pass “5” to the grid via a link, so
http://{website}/location_grid/location_grid.php?customer_id=5
gives me the subset I need?
I guess the bigger question is this:
Is there a way to conditionally generate the SQL statement based on what variables are passed on the address line?
So,
http://{website}/location_grid/location_grid.php
would use
SELECT location_id, location_active, location_name FROM locations
But
http://{website}/location_grid/location_grid.php?customer_id=5
would use
SELECT location_id, location_active, location_name FROM locations WHERE customer_id=5
?
Help.