My guess would be that the root cause is in the preceding line(s), such as a missing closing double-quote.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Yup. Missing ";"s will get you every time.
You might want to look at Komodo from ActiveState. Komodo's an editor that lays code out for you, and pre-empts the function name while you're typing.
For instance, if you type "mysql_q" it will know you're looking for mysql_query. It will make your job easier.
And there's a free version!
I would also separate the sql from the query. It will make your code easier to read, and deliver some functionality down the track when you step up a level in your scripting.
The other suggestion is to get into the habit of specifying your link, that is, ($query, $link) instead of just ($query).
At the moment, you're probably using a single data file, but mySQL allows you to use many, each specified with a different link. As your application grows (it will) and you add more features (you will), it will save you the trouble of having to go back and rework your queries.
Cheers
CTB
Oh Lord, please help me be the person my dog thinks I am.
Bookmarks