The php version doesn't matter on the server with the database. The php version used is the one where your .php files are hosted. MySQL and MySQLi aren't different databases, they are different ways php interacts with the database.
It looks like a completely hand coded mysqli page, not using webassist extensions. It is hard for me to say where it is wrong. If you gave me a live url and ftp access I could try to help you debug it.