Re: You will all probably laugh at this. [message #172492 is a reply to message #172490] |
Mon, 21 February 2011 11:05 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma:
|
Senior Member |
|
|
El 21/02/2011 11:58, Rob Bradford escribió/wrote:
> I can't get a call to an external php scrip to execute, it jst lists
> the code in the page rather than run it. If I place the code directly
> into the page it runs fine. As the code is a db connect string I dont
> want in an external php that is called as an when required.
>
> Within the base page I have tried:
>
> <?php
> include("con.php");
> other php in-line code
> ?>
>
> and
>
> <?php
> require("con.php");
> other php in-line code
> ?>
>
> All that happens is it echo's the contents of con.php then the rest
> fails as there is no db connection. I'm fairly new to this, but not
> programming. To be honest the google pages I have pulled up have been
> no help, has anyone any idea what I am doing wrong.
You don't post the contents of "con.php" but I'd dare say you are
omitting the PHP delimiters: <?php ... ?>
«When a file is included, parsing drops out of PHP mode and into HTML
mode at the beginning of the target file, and resumes again at the end.
For this reason, any code inside the target file which should be
executed as PHP code must be enclosed within valid PHP start and end tags.»
http://es2.php.net/manual/en/function.include.php
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
|