ho provato il tuo script mi da questo errore:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #10' at line 1

cmq avevi dimenticato una parentesi chiusa

if(mysql_num_rows($result){

cmq non è per quello che non va...