only1perky Posted February 13, 2008 Share Posted February 13, 2008 Hi guys, I'm working on a site and would like to be able to change the page title according to what is displayed from the database. Currently the page title is simply a default contained in the header which is included in the details_to_display page. How would I go about changing the title so it pulls the info of the category from the database and rewrites the title in the header.php page accordingly. Hope this makes sense. Link to comment https://forums.phpfreaks.com/topic/90931-change-page-title-from-database/ Share on other sites More sharing options...
revraz Posted February 13, 2008 Share Posted February 13, 2008 Use a variable name for the title? Link to comment https://forums.phpfreaks.com/topic/90931-change-page-title-from-database/#findComment-466029 Share on other sites More sharing options...
Isityou Posted February 13, 2008 Share Posted February 13, 2008 Try something like this <?php $sql = "SELECT {field_name} FROM {table_name}"; $result = mysql_query($sql); $row = mysql_fetch_row($result); ?> <head> <title><?php echo $row[0] ?></title> </head> Replace your db info inside the brackets. Link to comment https://forums.phpfreaks.com/topic/90931-change-page-title-from-database/#findComment-466031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.