updated from mysql to mysqli for future compatibility with php and security