if(mysql_query("UPDATE atria_es SET idatria='$idnew' WHERE idatria='$row[0]'")){ $idnew++;}else{ die('Error en la consulta: '.mysql_error());}