Because you are not using the addslashes() function, or your magicquotes is f-ing things up.
The apostrphes in your query must be escaped by a backslash.
IN some PHP setups this happens automatically, in some setups this has to be done manually.
Personally I prefer to do it manually, because the automatic systems often f-up.