Do you use cookies or javascript to define your mysql query?
That is about the only thing that could stop your mysql command from working.
Try using some error checking:
if (!$result=mysql_query())
{
echo "Mysql error\n";
echo mysql_error();
};
that will tell you why your query failed.