The mysql query dies? In that case, you could use the or die() on the query:
$result = mysql_query($query) or die(mysql_error());
Which would provide the reason...likely syntax somewhere. If that's not it, what is dieing? (Sorry if I'm missing the idea!)