First commit of database.php, favorite retrieval added