Your problem is you are not converting the array from mysql_fetch_array/big hint right there/() into an integer correctly. The array you are converting to an integer really holds the interger it is that you want.