Non bastava fare cut&paste di quello che ti ho dato, se scrivi così dopo aver chiamato mysql_query():
dovrebbe mostrarti la tua query che hai generato e gli errori che ti dà mysql e quindi puoi farti il debug !!Codice PHP:
echo $query." ".mysql_error();
Che so, ad esempio magari scopri che $ident non ha il valore che ti aspetti...