Can I dynamically select a column to filter in a recordset?
Hi,
I am trying to filter a recordset dynamically, depending on a URL variable. (let's call it 'sort')
If the URL variable is 'rankPrice', I want the recordset to filter on a value (specific value, for example 100) from the rankPrice column of my database table.
If the URL variable is 'rankDate', I want the recordset to filter on a value (specific value, for example 100) from the rankDate column of my database table.
Is this do-able?
I have tried capturing the URL variable and using it in the WHERE clause of the recordset, but it doesn't seem to work at all.
SELECT *
FROM madelenaitemsforweb
WHERE sortOrder = 151
Server variable:
Name: sortOrder
Type: text
Default value: rankPrice
Runtime value: $_GET['sort']
Any advice much appreciated.
Thanks,
Ben