Transition to mysqli

Might need testing