in reply to Using variables within a mysql query

Print the string you're sending to the DB before hand and make sure it's what you think it's supposed to be. See also the documentation for the trace method in the DBI docs (a value of 2 usually should be sufficiently verbose to show what's being sent to the backend).

(And also I think you mean $orderfield eq "id", not ==; but that's neither here nor there</nit> :)

The cake is a lie.
The cake is a lie.
The cake is a lie.