I wonder what you've done to work this issue. Here you make a post, title and dumped code. That's pretty short and may not tell us if the connection or the data didn't make it to the server.
Anyhow. Take your $query from line 28 and manually try it with your SQL command line. Does that work?