Hi,
I have been trying to create a small CMs with a Staff page, content page and index page. I have created a navigation system and this appears to work fine. The database has fields id, menu_name, position, visible, and content.
the content page is a trial page. A lot of it is html and css. I am trying out the php in the first main box in the centre.
However when i try to draw down the contents of the table, when I click on home I get the home contents "this is home". But when i click on other menu items the same content comes up - "this is home".
http://www.books3333.com/content.php
The functions are as follows:
The content page is as follows:PHP Code:function confirm_query($result){
global $connection;
if(!$result){
die("Database query failed".mysqli_error($connection));
}
}
/*---------------------------------------get_menu_names----------------------------------------*/
function get_menu_names(){
global $connection;
$query="Select * From pages ";
$result=mysqli_query($connection,$query);
confirm_query($result);
return $result;
}
/*--------------------------------------Read database--------------------------------------------*/
function get_subjects_by_id($subject_id){
global $connection;
$query = "SELECT * FROM pages ";
$result=mysqli_query($connection,$query);
confirm_query($result);
if($subject = mysqli_fetch_array($result)){
return $subject;
}else{
return NULL;
}
}
I have not put all the html and css for this page in.PHP Code:<?php include("includes/connect.php");
include("includes/functions.php");
if(isset($_GET['entry'])){
$sel_name = $_GET['entry'];
}else{
$sel_name = "";
}
$allpages = get_subjects_by_id($sel_name);
include("includes/header.php");
?>
<link href="temps1.css" rel="stylesheet" type="text/css">
<div class="menu">
<ul >
<?php
//get-menu-names() draws down the data. The while loop puts the data in the right place in the list.
$result = get_menu_names();
while($row=mysqli_fetch_array($result )){
echo "<li><a href=\"content.php?entry="
.urlencode($row['id'])."\">"
.$row['menu_name']."</a></li>";
}
?>
</ul>
</div><!--end menu-->
</div><!--end outerbanner-->
<div class="maincontent"><div class="newsbox"><h3><b><u>Corporate News</u></b></h3><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ornare, nibh a posuere viverra, leo leo varius felis, nec molestie nisi arcu quis lorem.</p><h4 align="center" class="style1"><u>New Policies</u></h4>
<p> Fusce dignissim, tortor et ullamcorper eleifend, diam felis auctor mauris, mollis blandit est lacus vel nulla. Vestibulum ante ipsum primis. Fusce dignissim, tortor et ullamcorper eleifend, diam felis auctor mauris, mollis blandit est lacus vel nulla.</p><h4 align="center" class="style1"><u>Wind of Change</u></h4>
<p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce porttitor nisl ac tellus tincidunt adipiscing. </p></div><!--endof newsbox-->
<div class="splash"><div class="servicepics1" >
<div class="servicepic"><img src="images/offices1.jpg" /></div><!--pic1-->
<div class="servicepic"><img src="images/officemeeting1.jpg" /></div><!--pic2-->
<div class="servicepic"><img src="images/officeadvice1.jpg" /></div><!--pic3-->
<div class="servicepic"><img src="images/officeGirl1.jpg" /></div><!--pic4-->
</div><!--end of servicepics wrap-->
</div><!--end of splash-->
<div class="databox">
<div class="data1"><?php echo $allpages['content']; ?> </div>
<!--end of data1-->
Can any one see where I am going wrong?
Thanks for your help
cass27








Bookmarks