I will pretend that I have understood and open to correction :)
I will assume also that you can query the database. There might be several way to do that but one of them is this for procedure (a bit different and easy for OOP)
index.php
<?php
include("functions.php");
?>
<html>
<head>
<title><?php echo getTitleFromDbFunction($argumentIfAny); ?></title>
</head>
<body>
<!---put your body stuffs here-->
</body>
</html>
functions.php
<?php
function getTitleFromDbFunction($argumentIfAny){
//get the title from database.argumentIfAny can be ID of title from Get or whatever
return $theRetrievedTitle;
}
?>
Note: this is to give Idea, untested and so unwarranted!