Migration from mysqli to mysql extension