Just as a side point, you should use mysql_real_escape_string() - the following is from the documentation of mysql_escape_string():
WarningThis function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.
I don’t know if having the single quotes in the string affects it when you put the variable straight in the string, because I always concatenate, but that could be it perhaps?