Fatal error: input in flex scanner failed in /filelocation/ on line 1

I am getting this error message after running
two select queries (which are similar but I need to include the results):

The query is "Select feildname from table where id=$id"
then while that is true include the feildname
on the page.
This works fine if I use one query but once
I do the other query I get the error.

What does this error mean and how can I get
around it.

Please help !

Thank You