MySQL updated to MySQLI

It is messy, but it works.