And depending upon where $text is coming from and what data it might hold, you should probably run it through [man]mysql_real_escape_string/man first.
EDIT: Just in case it isn't clear to the OP why these solutions will work...
Since $text is (presumably) text, you need to surround it in single quotes in your query. Without the quotes, MySQL thinks you're giving it a numeric value, or some MySQL keyword. It works the same as in PHP - when you give a variable a string value in PHP, you have to surround the string in quotes, whereas for numeric values you don't use quotes.