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.
<div id="content">
<?php
$pages_dir = 'inc';
if(!empty($_GET['page'])){
$pages = scandir($pages_dir, 0);
unset($pages[0], $pages[1]);
$page = $_GET['page'];
if (in_array($page.'.php', $pages)){
include $pages_dir.'/'.$page.'.php';
} else {
echo "<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 ($pages_dir.'/home.php');
}
?>
</div> <!-- end of wrapper -->
<?php require_once 'inc/footer.php'; ?>
Try $query->fetchAll() instead of $query->fetch().
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
The first problem is that there is not a field called content in the DB. I see that 1, I have had several suggestions and think I have mixed them up at some point so re-entered the code you gave me. Now I need to enter all the fields in the SELECT query and see where that leaves me.
This is what I have now, starting to make a little sense to me, I think
With the code NogDog has given me and my small amendments to my SELECT statement I now have the following code, the echo statement is not what I need to work on as the meta info is out of sync now so need to get the right fields called in.
Bookmarks