Can I dynamically select a column to filter in a recordset?
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.
WHERE sortOrder = 151
Default value: rankPrice
Runtime value: $_GET['sort']
Any advice much appreciated.