Closed TTarrier closed 10 years ago
Could you post some of your code too please :-)
Sure
index.php
<?php include('config/setup.php');?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?php echo $page['title'].' | '.$site_title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php include ('config/css.php');?>
<?php include ('config/js.php');?>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<ul class="nav navbar-nav">
<li <?php if($pageid == 1) {echo 'class="active"';}?>><a href="?page=1">Home</a></li>
<li <?php if($pageid == 2) {echo 'class="active"';}?>><a href="?page=2">Specs</a></li>
<li <?php if($pageid == 3) {echo 'class="active"';}?>><a href="?page=3">Schedule</a></li>
<li <?php if($pageid == 4) {echo 'class="active"';}?>><a href="?page=4">Announcements</a></li>
</ul>
</div>
</nav><!-- END Main Nav -->
<div class="container">
<h1><?php echo $page['header']; ?></h1>
<p><?php echo $page['body']; ?></p>
</div>
<footer id="footer">
<div class="container">
<p>This is a Footer</p>
</div>
</footer><!-- End Footer -->
</body>
</html>
Setup.php:
<?php
//Setup File:
#Database Connection Here...
$dbc = mysqli_connect('******************','************','*************','***') OR die('Could not connect because: '.mysqli_connect_error());
# Functions:
include('function/data.php');
$site_title = 'Title';
if(isset($_GET['page'])) {
$pageid = $_GET['page'];// Set $pageid to equal the value given in the URL
} else {
$pageid = 1;// Set $pageid to equal to 1 or the Home Page
}
#Page Setup
$data = data_page($dbc, $pageid);
?>
data.php:
<?php
function data_page($dbc, $id) {
$q = "SELECT * FROM pages WHERE id = $id";
$r = mysqli_query($dbc, $q);
$data = mysqli_fetch_assoc($r);
return $data;
}
?>
Found it :-)
On this line...
#Page Setup
$data = data_page($dbc, $pageid);
Change it to...
#Page Setup
$page = data_page($dbc, $pageid);
Because here:
<div class="container">
<h1><?php echo $page['header']; ?></h1>
<p><?php echo $page['body']; ?></p>
</div>
You are referring to the $page
array. Not $data
I made that change but I am still not seeing anything but a blank page.
I figured out the issue. I am running this on a linux server and did not have the /var/www file setup with the correct permissions so I could not access the files within. Thanks for the help.
Upon creating the data.php file and changing the page setup to $page = data_page($dbc, $pageid); my page no longer displays any information at all.