http://qs1969.pair.com?node_id=685955

sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:

SELECT id, name, location FROM book WHERE 1 ORDER BY $orderfield DESC
The above doesn't work when $orderfield is used, but when swapped with the actual field name "id" it works just fine. By not working, I mean it returns with "query returned empty".

After a test print, it shows that $orderfield eq "id" which is the exact name of the column.

Any ideas what might be hanging this up? And would it be possible to also change ASC/DESC to a variable as well?



"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid