Yes, it will help definitely. But you need to do a little customization.
First of all, make sure that you connect to the database, if you want to query / fetch data from database. For this to happen, include the "config.php" page at the very beginning of the script, in which your database connection logic will be present.
Then, write your query to fetch data from that database, and assign that value to the required variable for using it in the header page.
Lastly, include your "header.php" page.
For "config.php" page:-
Logic of Database Connection, like using of "mysql_connect()" & "mysql_select_db()" functions.
For "custom.php" page:-
<?php
include "config.php";
$sql = "SELECT pageTitle FROM db_table WHERE condition = 'something'";
$sql_exe = mysql_query($sql) or die("Error in Fetching Page Title");
if( mysql_num_rows($sql_exe) ) {
$currentPage = mysql_result($sql_exe, 0, 0);
}
else {
$currentPage = "Random Page Title";
}
mysql_free_result($sql_exe);
include "header.php";
?>
Also, if you want, you can always use some class for mysql connection & queries, to fetch data. But this is how it always work.