I have gone through the numerous threads regarding this subject but cannot translate any of the solutions over to my basic project. I have followed a tutorial on a basic dynamic site, the index page calls in home.php or whichever is selected from the menu. I have connected to a Mysql DB, this is working fine. I have my SELECT statement and variables in place with help from various sources however I only get the first record meta and title information showing no matter which page I view.

I have tried as with a static site having a $page_id on ever page, this worked fine with a static site but when it came to transferring that over to the dynamic site I am getting no where fast.

I would be grateful for some help and assistance. Thanks in advance.

My code so far is

PHP Code:


include 'connect.php';
$page_id =  'meta_id';
$title 'title';
$pname 'name';
$desc 'description';
$key 'keywords';
$aut 'author';
$copyr 'copyright';
$email 'email';
$rating 'rating';
$robots 'robots';
$visit 'revisit';
$exp 'expires';
$dist 'distribution';
$sql "SELECT * FROM `meta_data` WHERE `meta_id` = {$page_id}";
$query $db->query($sql);
$row $query->fetch(PDO::FETCH_ASSOC);                                                         
        unset (
$row['meta_id']) ;  // discard that one 
foreach ($row as $desc => $content) {
"<meta name=\"$desc\" content=\"$content\" />\n" ;    
My site code is

PHP Code:

         // index.php

<?php require_once 'inc/header.php'?>

<div id="content">
$pages scandir($pages_dir0);
$pages[0], $pages[1]);    
$page $_GET['page'];
        if (
        } else {
"<br><b>Sorry that page does not exist.</b><br><br>You will be redirected in 5 seconds to the homepage.";        
header("refresh:5; index.php");
    } else {
        include (
</div> <!-- end of wrapper -->
<?php require_once 'inc/footer.php'?>
The header.php file is

PHP Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php include_once 'fetchmeta.php'?>
<link href="inc/styles.css" rel="stylesheet" type="text/css" media="screen">

<div id="wrapper">
<div id="header"><h1>Dynamic Site</h1></div>

<?php include 'menu.php'?>
As I say I have tried including a $page_id variable on the content pages but this does not do anything.

PHP Code:
<?php $page_id 1?>

Welcome to the home page
Could someone shed some light on where I am going wrong. Thanks again.