Convert mysql_ to mysqli_

Change mysql_ methods to mysqli_, removing deprecation warnings from the former.  Used https://github.com/philip/MySQLConverterTool with additional cleanup.