473,397 Members | 1,974 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,397 software developers and data experts.

Include

How can I include another php file into a php file. In HTML you use <?php
include test.php?>. But I want to include test.php somewhere in my php
script. How can I make that work ??

--
RotterdamStudents
-------------------------------
Dulce est despirere loco
(Horatius, "Oden" 4,12,28)

Jul 17 '05 #1
4 1865
In article <c7**********@news.cistron.nl>,
"RotterdamStudents" <N0********@willeboerm.cistron.nl> wrote:
How can I include another php file into a php file. In HTML you use <?php
include test.php?>. But I want to include test.php somewhere in my php
script. How can I make that work ??


Just put

include('test.php');

at the point in your php file where you need to include test.php.

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #2
> > How can I include another php file into a php file. In HTML you use
<?php
include test.php?>. But I want to include test.php somewhere in my php
script. How can I make that work ??


Just put

include('test.php');

at the point in your php file where you need to include test.php.

JP


Thanks but this doesn't work. Below you see the script i want it in:

<?php
require "ind.inc.php";
$ezine_db = ezine_connecte_db();
$datum = strftime("%d %m %Y", $datum);

$str_requete = "SELECT fid,link FROM fotos ORDER BY fid ASC";

$result_articles = mysql_query ($str_requete,$ezine_db) or
ezine_mysql_die();

print ('<table width=75%><font face=arial size=2>');

while ($articleDb =mysql_fetch_object($result_articles))
{
print("
<tr><font face='arial' size='3'><td><img
src='pics/$articleDb->link.jpg' width=400 heihgt=300
alt=$articleDb->link.jpg></td></tr>
<tr><td>include('test.php');</td></tr>
");
}

print ('</font>');

?>
--
RotterdamStudents
-------------------------------
Dulce est despirere loco
(Horatius, "Oden" 4,12,28)
Jul 17 '05 #3
In article <c7**********@news.cistron.nl>,
"RotterdamStudents" <N0********@willeboerm.cistron.nl> wrote:
print("
<tr><font face='arial' size='3'><td><img
src='pics/$articleDb->link.jpg' width=400 heihgt=300
alt=$articleDb->link.jpg></td></tr>
<tr><td>include('test.php');</td></tr>
");


This doesn't work because the include() is in the argument of print(),
so it is interpreted as a string. You could split it up like this:

print("<tr><font face='arial' size='3'><td><img
src='pics/$articleDb->link.jpg' width=400 heihgt=300
alt=$articleDb->link.jpg></td></tr>
<tr><td>");

include('test.php');

print('</td></tr>');

JP

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #4
"RotterdamStudents" <N0********@willeboerm.cistron.nl> wrote in message
news:c7**********@news.cistron.nl...
How can I include another php file into a php file. In HTML you use <?php include test.php?>. But I want to include test.php somewhere in my php
script. How can I make that work ??


Just put

include('test.php');

at the point in your php file where you need to include test.php.

JP


Thanks but this doesn't work. Below you see the script i want it in:

<?php
require "ind.inc.php";
$ezine_db = ezine_connecte_db();
$datum = strftime("%d %m %Y", $datum);

$str_requete = "SELECT fid,link FROM fotos ORDER BY fid ASC";

$result_articles = mysql_query ($str_requete,$ezine_db) or
ezine_mysql_die();

print ('<table width=75%><font face=arial size=2>');

while ($articleDb =mysql_fetch_object($result_articles))
{
print("
<tr><font face='arial' size='3'><td><img
src='pics/$articleDb->link.jpg' width=400 heihgt=300
alt=$articleDb->link.jpg></td></tr>
<tr><td>include('test.php');</td></tr>
");
}

print ('</font>');

?>
--
RotterdamStudents
-------------------------------
Dulce est despirere loco
(Horatius, "Oden" 4,12,28)


probably the best solution is to change your code to this...

while ($articleDb =mysql_fetch_object($result_articles))
{
print("<tr><font face='arial' size='3'><td><img
src='pics/$articleDb->link.jpg' width=400 heihgt=300
alt=$articleDb->link.jpg></td></tr><tr><td>");
include('test.php');
print ("</td></tr>");
}

.... supposing that test.php contains just HTML. i didnt test this to check
for errors but im sure it would work. BTW you spelled "height" wrong in the
height attribute of your image (you spelled it "heihgt")

- JP
Jul 17 '05 #5

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

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
9
by: zolli | last post by:
Hi, I've been banging my head against this for a while now. Hoping someone here can shed some light on what's going on. On including stdlib.h in a file, I'm seeing the following errors: ...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
1
by: Minh | last post by:
I've just installed VS.NET 2003 on my Athlon XP 1800+. However I couldn't get any project with STL includes to compile even if I create a new empty project (and added #include <string>). It gave me...
1
by: ya man | last post by:
when i use #include <iostream.h> in some files i get lots of error messages of the kind 'ambiguous symbol this is solved when i use #include <iostream why is that ? and can i use #include...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
7
by: Giancarlo Bassi | last post by:
Please, what are here the 11 include files (found over the internet)? */mozzarella.c /* #include #include #include #include #include #include
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.