Updated mysql constructs to mysqli