Dynamic Meta Tags from MySQL DB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Allan Skyner

    #1

    Dynamic Meta Tags from MySQL DB

    I'm searching internet and although there is lots of info on this subject I'm still not having any success, so I'm looking for some help on where I'm going wrong. (must add that I'm a novice).

    I have a table "news" with fields NEW_Headline and NEW_Summary, the news.php with "include php/news.php" dynamically load each news item.

    In the head tag of news.php it has a static title of "News Item" that I want to change and dynamically load the NEW_Headline as the page title and also have meta tag description using NEW_Summary.

    I did find this information to add in the head section of news.php:
    <title><?php echo $pageTitle; ?></title>
    <META name="descripti on" content="<?php echo $metaDescriptio n; ?>" />

    Followed with adding this to php/news.php
    ?php
    $pageTitle = "My page title";
    $metaDescriptio n = "My page description.";
    ?>

    I just need to add the query and results that will change the "My Page Title" to equal the individual NEW_Headline and the "My Page Description" to NEW_Summary.

    Very greatful for the directions and assistance.
Working...