Are you using a standard or MySQLi connection when you get this error? Is this on a blank page? Can you try on a blank page and see if you get a similar error?
Does it connect to the database and show your columns correctly?
If it works on other pages and not on the page you are trying to add it to, then I'll probably need a copy of that page to figure out why. Maybe you could give me FTP access so I can try to apply the same server behavior on the same page. If I can reproduce the error then I'll be able to fix it. If I can't, then I'll probably need to do screen sharing with you to debug this further.