In mysql the # character is used to indicate a comment. Using a # will comment out a line
SELECT *
FROM mytable
WHERE x=y
also want y=1
AND y=1
If your new server has collapsed these lines before processing
SELECT * FROM mytable WHERE x=y # also want y=1 AND y=1
the second part of the WHERE clause will not be applied
So somehow or other, your # in submitted text is being viewed as a comment. I'm with Laserlight: show us the query!