in reply to Getting something wrong with SQL

I dont understand whats wrong here

Take the backquotes off of the fieldnames in that query. They're not needed.

I'm guessing that the error message you're seeing is from  , param(last), without being quoted, "last" looks like a keyword, and Perl doesn't expect to see "last" outside of a loop. Hence the complaint.

To fix this, you need to give Perl a hint about what type of a thing "param" is. If it's a hash, then write   $param{"last"} instead of   param(last) Or if you're using param() from CGI.pm, you still need to quote the argument. Use   param("last")