Updating this to use mysqli