Switching mysql to mysqli functions.

MySQL is deprecated in PHP 5.5 : see http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php