please i am having a mozila firefox for this page
<?php require_once("include/connection.php"); ?>
<?php require_once("include/functions.php"); ?>
<?php include("include/header.php"); ?>
<div id="navigation">
<ul>
<?php
//3. perform database querry
$subject_set = mysql_query("SELECT * FROM subjects", $connection);
if (!$subject_set) {
die("Database query failed: " . mysql_error());
}
//4 use returned data
while($subject = mysql_fetch_array($subject_set)) {
echo "<li>{$subject["menu_name"]}</li>";
$page_set = mysql_query("SELECT * FROM pages WHERE subject_id =
{$subject["id"]}", $connection);
if (!$page_set) {
die("Database query failed: " . mysql_error());
}
//4 use returned data
while($page = mysql_fetch_array($page_set)) {
echo "<li>{$page["menu_name"]}</li>";
}
?>
</ul>
</div> <!--end of navigation div -->
<div id="bodycontent">
<h3> content area</h3>
<p> i hope this works. </p>
</div>
<?php
require("include/footer.php"); ?>
What do you mean? You’re having a problem in Firefox for that page?
What problem are you having?
the page is not loading, and there is not n the page source
Pop these 2 additional lines at the top of that page, it should help.
<?php error_reporting(-1); ?>
<?php ini_set('display_errors', true); ?>
<?php require_once("include/connection.php"); ?>
<?php require_once("include/functions.php"); ?>
<?php include("include/header.php"); ?>
...
...
...
Once you’ve done what Anthony suggests, it will show some errors about the following:
mysql_query("SELECT * FROM pages WHERE subject_id = {$subject["id"]}"
Here you’re using double-quotation marks within double quotation marks, which doesn’t work. Try changing it to :
mysql_query("SELECT * FROM pages WHERE subject_id = {$subject['id']}"
There’s a couple of those errors in there.
i have changed it but no difference , i changed “id” to ‘id’
and “menu_name” to ‘menu_name’
Immerse:
Once you’ve done what Anthony suggests, it will show some errors about the following:
mysql_query("SELECT * FROM pages WHERE subject_id = {$subject["id"]}"
Here you’re using double-quotation marks within double quotation marks, which doesn’t work. Try changing it to :
mysql_query("SELECT * FROM pages WHERE subject_id = {$subject['id']}"
There’s a couple of those errors in there.
As the variable (or array) is in a double quoted string, you can omit quoting the array key altogether; I actually think it will error if you try to quote it.
<?php
error_reporting(-1);
ini_set('display_errors', true);
$array = array('name' => 'anthony');
//Okay
echo "Hello, $array[name].";
//Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING'
echo "Hello, $array['name'].";
//Okay
echo "Hello, {$array['name']}.";
thanks, i have turned it on, but its not displaying errors, and i have also change the double quote to a single quote.
<?php error_reporting(-1); ?>
<?php ini_set('display_errors', true); ?>
<?php require_once("include/connection.php"); ?>
<?php require_once("include/functions.php"); ?>
<?php include("include/header.php"); ?>
<div id="navigation">
<ul>
<?php
//3. perform database querry
$subject_set = mysql_query("SELECT * FROM subjects", $connection);
if (!$subject_set) {
die("Database query failed: " . mysql_error());
}
//4 use returned data
while($subject = mysql_fetch_array($subject_set)) {
echo "<li>{$subject['menu_name']}</li>";
$page_set = mysql_query("SELECT * FROM pages WHERE subject_id =
{$subject['id']}", $connection);
if (!$page_set) {
die("Database query failed: " . mysql_error());
}
//4 use returned data
while($page = mysql_fetch_array($page_set)) {
echo "<li>{$page['menu_name']}</li>";
}
?>
</ul>
</div> <!--end of navigation div -->
<div id="bodycontent">
<h3> content area</h3>
<p> i hope this works. </p>
</div>
<?php
require("include/footer.php"); ?>
thanks for the patience
So you get a blank page in Firefox? What do you see when you right click on the blank page and choose ‘View page source’?
Does it work in other browsers?
it is blank, nothing for also for safari
So it’s not just FF, it doesn’t work in any browser.
Even when you look at the HTML code, there is nothing.
None of the errors Immerse found caused an error message.
My guess is the script is stopped before it even reaches the <div id=“navigation”> line.
What is inside those includes?
the include file has the header, footer, databse connection
<?php
require("constant.php");
//1.create database connection
$connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
if (!$connection) {
die("Database connection failed: " . mysql_error());
}
//2 select database to use
$db_select = mysql_select_db(DB_NAME,$connection);
if (!$db_select) {
die("Database selection failed: " . mysql_error());
}
?>
<?php
require("constant.php");
//1.create database connection
$connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
if (!$connection) {
die("Database connection failed: " . mysql_error());
}
//2 select database to use
$db_select = mysql_select_db(DB_NAME,$connection);
if (!$db_select) {
die("Database selection failed: " . mysql_error());
}
?>
<div id="footer">
<ul id="footlink">
<li><a href="contact.html">Contact us</a></li>
<li><a href="termsandcondition.html">Terms&Condition</a></li>
<li><a href="right.html">Copyright</a></li>
<li><a href="faq.html">Faq</a>
</li>
</ul>
</div>
</body>
</html>
<?php
//5. close connection
if (isset($connection)) {
mysql_close($connection);
}
?>
You’re right! I kinda forgot because I never ever use this method of string substitution. I prefer the ages-old plain method of sticking bits together with dots.
Back on topic:
Can you change:
mysql_query("SELECT * FROM pages WHERE subject_id =
{$subject['id']}", $connection);
to:
mysql_query("SELECT * FROM pages WHERE subject_id =
{$subject[id]}", $connection);
[ot]
What we need here is a ConcatentationRecursiveIteratorIterator [/ot]
i have changed it, it still not showing anything
You posted the database connection include twice
It looks ok though.
Please repost the header include.
And the functions include?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Reacheasy - Foremost website for easy reach of things globally</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link href="easy.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="outer">
<div id="page">
<div id="header">
<h1>Reacheasy</h1>
<ul id="nav">
<li class="current"><a href="index.html">Home</a></li>
<li><a href="women.html">Women</a></li>
<li><a href="men.html">Men</a></li>
<li><a href="children.html">Children</a></li>
<li><a href="homeandappliances.html">Home&Appliances</a></li>
<li><a href="visionandsound.html">Vision&Sounds</a></li>
<li><a href="motoring.html">Motoring</a></li>
<li><a href="homemore.html">More</a></li>
<li><a href="homecontact.html">Contact us</a></li>
<li><a href=" rl.html">Register/Log in</a></li>
</ul>
</div> <!--end of navigation div -->
</div>
Are you sure you’re calling that script?
Try adding this line at the beginning:
[B][COLOR="Red"]TEST[/COLOR][/B]
<?php error_reporting(-1); ?>
<?php ini_set('display_errors', true); ?>
<?php require_once("include/connection.php"); ?>
<?php require_once("include/functions.php"); ?>
<?php include("include/header.php"); ?>
<div id="navigation">
<ul>
<?php
//3. perform database querry
$subject_set = mysql_query("SELECT * FROM subjects", $connection);
if (!$subject_set) {
die("Database query failed: " . mysql_error());
}
//4 use returned data
while($subject = mysql_fetch_array($subject_set)) {
echo "<li>{$subject['menu_name']}</li>";
$page_set = mysql_query("SELECT * FROM pages WHERE subject_id =
{$subject['id']}", $connection);
if (!$page_set) {
die("Database query failed: " . mysql_error());
}
//4 use returned data
while($page = mysql_fetch_array($page_set)) {
echo "<li>{$page['menu_name']}</li>";
}
?>
</ul>
</div> <!--end of navigation div -->
<div id="bodycontent">
<h3> content area</h3>
<p> i hope this works. </p>
</div>
<?php
require("include/footer.php"); ?>
I hope TEST will show up…