Firstly, if you haven't done so already, you must check that the database is at fault by placing ñ statically into a <select>.
Thereafter, if it is the database, either the data is stored incorrectly, or it is being extracted incorrectly - those are your only options.
If the database stores data in unicode/utf-8 format then it is likely that data is being stored incorrectly. OR If the database stores data in 8bit/Ansi format, that data will need to be converted to unicode/utf-8 format if it is going to be used on a unicode/utf-8 page.
In other words explicit conversion to unicode/utf-8 may be required either when storing data or when retrieving it.