In my efforts to update my code from using mysql_*, I have run into a whole heap of pain.
I decided to change my code using mysqli, first in the procedural style. After learning a bit more, I decided that actually the object-oriented style was better. When it came to using prepared statements, I ran into problems when I tried to use get_result(). I wanted to use this because I had lots of fields which needed to bound. So after looking into the issue, it appears you need the mysqlnd driver to use this, which is only available in PHP version 5.4. I was using version 5.3 so decided to upgrade.
After upgrading, I still had the error. After chasing my tail for ages, as this was something definitely outside of my area of knowledge, I discovered that mysqlnd had not been enabled for mysqli.
After speaking to my webhost support, I got the following reply:
It seems that mysqli can only be built against either the old libmysql libraries, or against mysqlnd. cPanel apparantly defaults to the older libraries since mysqli has been used for a long time with the older libraries.
We can try to force mysqli to build against mysqlnd ... but I have no idea what repercussions this might have if any other sites use mysqli already against the old libraries
This doesn't sound like a good idea, and at this stage (with plenty of time wasted) I'm thinking I should have never bothered and just stuck with mysql_* instead.
PDO has been mentioned but I know nothing about this. It seems similar to mysqli? I really don't want to invest more time in learning another something new, only then run into a similar brick wall further down the line.
There certainly isn't any plans to switch to a different type of database, so doesn't that defeat the object of using PDO? Should I just try to find some code that does the same thing get_result() does but that would work in 5.3?