quotes problem in very simple sql

if you’re communicating with the WordPress database itself, try using $wpdb->prepare() on your select string before running it as $wpdb->query() – it should format it for you.

Further reading: Codex