created a public function for detabase.php