run the code again, but this time, don't run the query directly,
set $QStr = to your query, then echo $QStr, then mysql_query($QStr)
there may be some problem in the variables, and when you echo $QStr, you see exactly what your query looks like.
paul13