sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
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".SELECT id, name, location FROM book WHERE 1 ORDER BY $orderfield DESC
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using variables withing a mysql query
by Fletch (Bishop) on May 11, 2008 at 16:46 UTC | |
Re: Using variables withing a mysql query
by wfsp (Abbot) on May 11, 2008 at 15:13 UTC | |
by sulfericacid (Deacon) on May 11, 2008 at 17:16 UTC | |
by psini (Deacon) on May 11, 2008 at 19:43 UTC | |
Re: Using variables withing a mysql query
by psini (Deacon) on May 11, 2008 at 16:31 UTC | |
Re: Using variables within a mysql query
by hesco (Deacon) on May 11, 2008 at 20:30 UTC | |
by psini (Deacon) on May 11, 2008 at 21:29 UTC |
Back to
Seekers of Perl Wisdom