All I am trying to do is create a dynamic site where a content section, a right menu (choice of 3) and tab section near the footer are dynamically selected depending on the user request. I have created a table in my database called 'contents' which has 3 variables called content_id, page_route, right_menu_select. The contents of these variables are primary key, the route to and name of the content (less the .php extension) and the route to and name of the right menu (less the .php extension).
So I have a basic includes page which just renders the page using files that have been created containing the various parts of the page, the first dynamic bit of the page is the contents section which includes ("content_selection.php") which is where I try and decide which page I should display for the content. The page_id is sent through the url of the page requested via the menu bars and found using a $_GET.
I am having no luck with getting the page name and route into a variable so that it can be passed back to the include on the index.php page.
The following code was my final attempt after attempting it many different ways...
<?php
if (!isset($_GET['page_id'])) { // if page_id isn't set
$selection = 1; // set it to 1
} else { // otheriwise
$selection = $_GET['page_id']; // copy it to selection
} // upto here works.
$sql = "SELECT page_route FROM content WHERE content_id == '$selection'";
$result = mysql_query($sql);
$row = mysql_fetch_array($results);
include $row['page_route'].".php"; // My guess at how to throw it back to index.php????????
print $row['page_route'].".php"; // But the variable is holding no data - this prints '.php'
?>
Am sure it's something simple but I can't get it, I am not a programmer which is obvious!
Any ideas and help much appreciated.