I assume you're using PHP with the looks of those variables and functions. Instead of writing the query directly inside the mysql_query() function, write it to a variable and print it before you fire off the query. This will help you debug these kinds of things much faster and more effectively.
$sql = "SELECT * FROM table WHERE id = '$id'";
echo $sql; // Comment out or delete this line after you have it working
I have a hunch one of your variables is null. At second glance.. I'm pretty sure you can't have array variables inside quotes like that. You need something like: