in reply to Basic error in CGI script
Not related with your current problem, but to prevent obscure problems in the future, never SELECT * FROM any table. Use explicit list of fields on every query...