Yeah I did paste the code in backwards, I was trying to explain it in English as oppose to code. Little stupid really considering, but it's an old habit from dealing with clients. 🙂
I have solved the problem and I think I know why it happened. It all stems from an earlier post of mine.
I was having a problem getting my login script (this script) to detect an access code from a mysql database and then forward to one of two pages debending on the returned code. The problem was that redirection in php is done using header() and as a header it needs to be defined at the start of the file. A suggestion from my other thread was to use ob_start() near the top of the script to hold everything in a buffer.
Unfortunately this appears to hold EVERYTHING in a buffer including the include statement I have which loads my mysql connection script. Therefore, no connection = invlaid argument.
At least that's what I think it could be; though I'm probably wrong.
So now I have two seperate login pages, one for each kind of user. It's a bit of a lame work around, but I've been stuck on this for days and I've gotten a little pi**ed off with it.