Page 1 of 1
included php file does not work
Posted: Thu Mar 22, 2007 10:03 pm
by hoangvu.che
I have two .php files, say a.php and b.php
a.php is included in b.php. When b.php is loaded, I dont know why the php code in a.php is not parsed (run).
When I check the source code in browser, the php code of a.php exists there.
Please help me with this.
Thanks.
Posted: Thu Mar 22, 2007 10:37 pm
by feyd
Posting an example of this behavior (the code, not the resultant HTML) would be helpful.
This isn't a theory thread however. Moved to PHP - Code.
Posted: Fri Mar 23, 2007 7:43 am
by aaronhall
How is b.php being included (should be
include() or
require()), and have you checked that b.php is wrapped with PHP tags (<?php and ?>)?
Posted: Fri Mar 23, 2007 10:43 am
by hoangvu.che
I use readfile() function as follows:
Posted: Fri Mar 23, 2007 10:52 am
by hoangvu.che
aaronhall, thanks for your answer.
I have tried include() instead of readfile() and it runs OK.
regards.
Posted: Fri Mar 23, 2007 11:33 am
by RobertGonzalez
Look into
include(),
include_once(),
require() and
require_once(). Each has a place and I am sure they could all be beneficial to you.