473,378 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problem including the other php file.

Hi,

I want to include three php files in index.php file like the code below. But
it always shows up only two, any two of the three, any order.

<tr>
<td><?php include ("includes/documents.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?>&nbsp;</td>
</tr>

Can anyone help me out?

Ben
Jun 8 '07 #1
10 1635
On Jun 8, 11:07 am, "Ben Sehara" <seh...@hotmail.comwrote:
Hi,

I want to include three php files in index.php file like the code below. But
it always shows up only two, any two of the three, any order.

<tr>
<td><?php include ("includes/documents.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?</td>
</tr>

Can anyone help me out?

Ben
Hi Ben,
the include() statement works in the same way of require(), with the
difference that require() is executed the first time the statement is
parsed, while include() is evluated each time the statement is
executed.

you may wanna work in this way:

<?php

if (variable == true)
{
include('file.inc');
}
else
{
echo 'hello!';
}
?>

bye,
V.

Jun 8 '07 #2
On Jun 8, 11:30 am, vinnie <centro.ga...@gmail.comwrote:
On Jun 8, 11:07 am, "Ben Sehara" <seh...@hotmail.comwrote:
Hi,
I want to include three php files in index.php file like the code below. But
it always shows up only two, any two of the three, any order.
<tr>
<td><?php include ("includes/documents.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?</td>
</tr>
Can anyone help me out?
Ben

Hi Ben,
the include() statement works in the same way of require(), with the
difference that require() is executed the first time the statement is
parsed, while include() is evluated each time the statement is
executed.
Umm, not quite. require() and include() are identical in every way
except for how they handle failure. If the file cannot be included
for some reason, require() will cause the entire script to die while
include will just throw a warning.

Jun 8 '07 #3
On Jun 8, 11:38 am, ZeldorBlat <zeldorb...@gmail.comwrote:
On Jun 8, 11:30 am, vinnie <centro.ga...@gmail.comwrote:
On Jun 8, 11:07 am, "Ben Sehara" <seh...@hotmail.comwrote:
Hi,
I want to include three php files in index.php file like the code below. But
it always shows up only two, any two of the three, any order.
<tr>
<td><?php include ("includes/documents.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?</td>
</tr>
Can anyone help me out?
Ben
Hi Ben,
the include() statement works in the same way of require(), with the
difference that require() is executed the first time the statement is
parsed, while include() is evluated each time the statement is
executed.

Umm, not quite. require() and include() are identical in every way
except for how they handle failure. If the file cannot be included
for some reason, require() will cause the entire script to die while
include will just throw a warning.
Correct! :)

Jun 8 '07 #4
Tom

"vinnie" <ce**********@gmail.comwrote in message
news:11**********************@n4g2000hsb.googlegro ups.com...
On Jun 8, 11:38 am, ZeldorBlat <zeldorb...@gmail.comwrote:
On Jun 8, 11:30 am, vinnie <centro.ga...@gmail.comwrote:
On Jun 8, 11:07 am, "Ben Sehara" <seh...@hotmail.comwrote:
Hi,
I want to include three php files in index.php file like the code
below. But
it always shows up only two, any two of the three, any order.
<tr>
<td><?php include ("includes/documents.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?</td>
</tr>
Can anyone help me out?
Ben
Hi Ben,
the include() statement works in the same way of require(), with the
difference that require() is executed the first time the statement is
parsed, while include() is evluated each time the statement is
executed.
Umm, not quite. require() and include() are identical in every way
except for how they handle failure. If the file cannot be included
for some reason, require() will cause the entire script to die while
include will just throw a warning.

Correct! :)
If you wanted to test for error messages for debugging purposes, is there a
way to redirect required() fatal errors to error_log? Was trying to find the
best way for them to track why all three includes weren't working. Would
required() just output the fatal error to the web page?

Tom
--
Newsguy.com - Basic Accounts $39.95 / 12 months

Jun 8 '07 #5
On Jun 8, 1:40 pm, "Tom" <t...@to.comwrote:
"vinnie" <centro.ga...@gmail.comwrote in message

news:11**********************@n4g2000hsb.googlegro ups.com...
On Jun 8, 11:38 am, ZeldorBlat <zeldorb...@gmail.comwrote:
On Jun 8, 11:30 am, vinnie <centro.ga...@gmail.comwrote:
On Jun 8, 11:07 am, "Ben Sehara" <seh...@hotmail.comwrote:
Hi,
I want to include three php files in index.php file like the code
below. But
it always shows up only two, any two of the three, any order.
<tr>
<td><?php include ("includes/documents.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?</td>
</tr>
Can anyone help me out?
Ben
Hi Ben,
the include() statement works in the same way of require(), with the
difference that require() is executed the first time the statement is
parsed, while include() is evluated each time the statement is
executed.
Umm, not quite. require() and include() are identical in every way
except for how they handle failure. If the file cannot be included
for some reason, require() will cause the entire script to die while
include will just throw a warning.
Correct! :)

If you wanted to test for error messages for debugging purposes, is there a
way to redirect required() fatal errors to error_log? Was trying to find the
best way for them to track why all three includes weren't working. Would
required() just output the fatal error to the web page?

Tom
--
Newsguy.com - Basic Accounts $39.95 / 12 months
It will be reported if you have error_reporting() turned up
sufficiently. It will be displayed in the output if you have
display_errors enabled in php.ini.

Jun 8 '07 #6

"Ben Sehara" <se****@hotmail.comwrote in message
news:vg******************@newsread2.news.pas.earth link.net...
Hi,

I want to include three php files in index.php file like the code below.
But it always shows up only two, any two of the three, any order.

<tr>
<td><?php include ("includes/documents.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?>&nbsp;</td>
</tr>

Can anyone help me out?

Strange... I would imagine that the order matters..

replace include with echo and see if it still has the same problem...

If not then replace your includes wiht simple files like

i.e. document.php =>
echo '1';
locations.php =>
echo '2';
....

and see if it still does the same thing. (try to narrow down the issue... if
if its what you have in your includes or if its the include statement
itself)

Its very strange that the order doesn't matter cause php starts from the top
down... the first include is included first so if it doesn't get included
some of the time then something very strange is going on or its some logical
issue in your php files.

Jun 8 '07 #7
I included the same and simple php file three times. It still shows the
first two. I checked the source. It is like this.

================================================== =================
<table width="760" align="center">
<tr>
<td>First Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
</td>
</tr>
<tr>
<td>Second Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
================================================== =================
The following is missing.

</td>
</tr>
<tr>
<td>Third Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
</td>
</tr>
</table>

The included file itself is showing right, but it stopped right after the
second included file. The documents.php file seems to be fine. Something
wrong with html tag? It's very simple though.

Ben
"Jon Slaughter" <Jo***********@Hotmail.comwrote in message
news:bU***************@newssvr17.news.prodigy.net. ..
>
"Ben Sehara" <se****@hotmail.comwrote in message
news:vg******************@newsread2.news.pas.earth link.net...
>Hi,

I want to include three php files in index.php file like the code below.
But it always shows up only two, any two of the three, any order.

<tr>
<td><?php include ("includes/documents.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?>&nbsp;</td>
</tr>

Can anyone help me out?


Strange... I would imagine that the order matters..

replace include with echo and see if it still has the same problem...

If not then replace your includes wiht simple files like

i.e. document.php =>
echo '1';
locations.php =>
echo '2';
...

and see if it still does the same thing. (try to narrow down the issue...
if if its what you have in your includes or if its the include statement
itself)

Its very strange that the order doesn't matter cause php starts from the
top down... the first include is included first so if it doesn't get
included some of the time then something very strange is going on or its
some logical issue in your php files.

Jun 9 '07 #8

"Ben Sehara" <se****@hotmail.comwrote in message
news:E4******************@newsread1.news.pas.earth link.net...
>I included the same and simple php file three times. It still shows the
first two. I checked the source. It is like this.
Its very important if its the "first two" or "any two". In any two that
means its random which means its much harder. If its the first two then it
means that its probably something simple. Your code is bugging out after the
second one.
================================================== =================
<table width="760" align="center">
<tr>
<td>First Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
</td>
</tr>
<tr>
<td>Second Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
================================================== =================
The following is missing.

</td>
</tr>
<tr>
<td>Third Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
</td>
</tr>
</table>

The included file itself is showing right, but it stopped right after the
second included file. The documents.php file seems to be fine. Something
wrong with html tag? It's very simple though.
Looks like your creating an error in documents.php(last few lines probably)
that is causing execution to stop. Happens all the time.

Very simple test to find problem... Remove the code that is including the
php files(just comment it out) and see if HTML is displaying properly(but
without the included stuff). If so then its your php files.

or better yet, make very simple php files like I said before that just echo
out stuff and then check the html again.

Essentially you need to add "markers" to see where the error is occuring.
You put "mile markers" in your code and you can narrow down the issue by
finding out the last message that was shown.

Jon
Jun 9 '07 #9
Sorry, I didn't mention what I have done. I removed the include file and
simple html worked fine. I replaced the include file with echo statement and
it worked fine.

Then, I replaced the echo statement with the include files, only the first
and second one worked fine.

I switched the first one with the third (not visible) one, again, the first
two files worked fine. This first one was not visible before. Any first two
include files worked fine even if you switch the files.

I tried the different include file in three places. Again, the first two
files worded fine.

Now I combined those files into one include file. It is OK for now. But if I
can find the resolution, I post it here.

Thanks for your help.

Ben
"Jon Slaughter" <Jo***********@Hotmail.comwrote in message
news:7U*******************@newssvr23.news.prodigy. net...
>
"Ben Sehara" <se****@hotmail.comwrote in message
news:E4******************@newsread1.news.pas.earth link.net...
>>I included the same and simple php file three times. It still shows the
first two. I checked the source. It is like this.

Its very important if its the "first two" or "any two". In any two that
means its random which means its much harder. If its the first two then it
means that its probably something simple. Your code is bugging out after
the second one.
>================================================= ==================
<table width="760" align="center">
<tr>
<td>First Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
</td>
</tr>
<tr>
<td>Second Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
================================================= ==================
The following is missing.

</td>
</tr>
<tr>
<td>Third Table Here</td>
</tr>
<tr>
<td>
<!-- start of documents.php -->
<table width="70%">
<tr>
<td width="33%"><a href="./docs/doc1.pdf">Doc1</a></td>
<td width="33%"><a href="./docs/doc2.pdf">Doc2</a></td>
<td width="33%"><a href="./docs/doc3.pdf">Doc3</a></td>
</tr>
<tr>
<td width="33%"><a href="./docs/doc4.pdf">Doc4</a></td>
</tr>
</table>
<!-- end of documents.php -->
</td>
</tr>
</table>

The included file itself is showing right, but it stopped right after the
second included file. The documents.php file seems to be fine. Something
wrong with html tag? It's very simple though.

Looks like your creating an error in documents.php(last few lines
probably) that is causing execution to stop. Happens all the time.

Very simple test to find problem... Remove the code that is including the
php files(just comment it out) and see if HTML is displaying properly(but
without the included stuff). If so then its your php files.

or better yet, make very simple php files like I said before that just
echo out stuff and then check the html again.

Essentially you need to add "markers" to see where the error is occuring.
You put "mile markers" in your code and you can narrow down the issue by
finding out the last message that was shown.

Jon

Jun 9 '07 #10
At Sat, 09 Jun 2007 18:04:46 +0000, Ben Sehara let h(is|er) monkeys type:
Sorry, I didn't mention what I have done. I removed the include file and
simple html worked fine. I replaced the include file with echo statement and
it worked fine.

Then, I replaced the echo statement with the include files, only the first
and second one worked fine.

I switched the first one with the third (not visible) one, again, the first
two files worked fine. This first one was not visible before. Any first two
include files worked fine even if you switch the files.

I tried the different include file in three places. Again, the first two
files worded fine.

Now I combined those files into one include file. It is OK for now. But if I
can find the resolution, I post it here.

Thanks for your help.

Ben
Just guessing here, could it be the case you are (re)defining functions or
classes in more than one include file? As suggested, set
error_reporting(ALL) in your script and display_errors to on (pref. in
php.ini)

Finally, Ben, please write your replies BELOW the message you are replying
to. Top-posting isn't considered good usenet practice.

Good luck,
Sh.

--
Schraalhans Keukenmeester - sc*********@the.Spamtrapexample.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples','oranges') < 0"

Jun 10 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Tim Ward | last post by:
I'm trying to make an image which is a chart of some data. The graphics code on its own works fine - this is a file which in outline is: <?php Header ('Content-Type: image/png'); $img =...
1
by: theburnetts | last post by:
I am building an ASP.NET application that has a requirement that the user should be able to download all of the data that they have input into the system and save it to a file on their local PC. ...
13
by: Bob | last post by:
I have been working on the following program. The goal is to have a tokenizing routine that avoids some of the problems of strtok(), the comments should explain the features. This runs fine on...
102
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
27
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set...
7
by: The Cool Giraffe | last post by:
I have the following: //A.h class A {}; //B.h #include "A.h" class B : A {};
12
by: Julian | last post by:
Hi, I am having problems with a function that I have been using in my program to read sentences from a 'command file' and parse them into commands. the surprising thing is that the program works...
10
by: michael | last post by:
Hi All, I have the following: ------------ file constants.h--------- #ifndef constants_ #define constants_ const int FOO = 1; const int BAR = 2;
10
by: strife | last post by:
Hey everyone, I was making a program for a class, and I ran into a problem that is driving me crazy. I first suspected Vista, and since I am not home I cannot verify if it just my Vista...
4
by: sharat | last post by:
Hi all. I am writing a a code in c++ . i have defined a global structure in a header file(user define header file) say headerfile1.h and declared a class in file2.h which is having some public...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.