When posting PHP code, please use the board's [noparse]
..
[/noparse] bbcode tags as they make your code much easier to read and analyze.
As for your problem, can you show us a fresh copy of your code? Also, don't use 'SELECT *' - instead, only SELECT the columns you need (which, in this case, appears to be just one column).
For any MySQL query: you should be checking to see if mysql_query() returns boolean FALSE, indicating that an error has occurred, and then either output or log detailed error information (such as the error message returned by the MySQL server).