In order to support PHP7, change the way to operate database. PHP7
removed the mysql extension, so the old way to operate database is
not usable. This commit use a new way to operate database.
BREAKING CHANGE: the way to operate database has changed.