Page 1 of 1
Php include statement doesn't work for me.
Posted: Sun Apr 08, 2007 8:52 pm
by quadoc
I've an include statement like include ("test.php"), but some how when I tested it it doesn't seem to include the file. Does anyone have any ideas? I'm using php ver. 5.2. Thanks...
Posted: Mon Apr 09, 2007 12:05 am
by Benjamin
What is the error message?
Re: Php include statement doesn't work for me.
Posted: Mon Apr 09, 2007 1:25 am
by dibyendrah
quadoc wrote:I've an include statement like include ("test.php"), but some how when I tested it it doesn't seem to include the file. Does anyone have any ideas? I'm using php ver. 5.2. Thanks...
Try printing some message in included files.
Like
Posted: Mon Apr 09, 2007 3:16 am
by timvw
most common problems:
- include_path does not included the working directory (.)
- webserver doesn't have rights to read the file
- the 'included' file contains php code that is not surrounded by <? ?>
Posted: Mon Apr 09, 2007 5:16 pm
by quadoc
Everah | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
ok, this is pretty weird! Before the upgrade to 5.2 upgrade, I can mixed match my code with html code like the xample below, but now it's not working any more. I've to echo those html code in order for it to work. Does anyone know why? Thanks...
Code: Select all
<?php
if(isset($index) != 1)
{
die("Please contact admin.");
} else {}
?>
<table width="600" border="0" align="center" cellpadding="1" cellspacing="1">
<tr align="left" valign="top">
<td colspan="4">';
<?
if(isset($index) != 1)
{
die("Please contact admin.");
}
?>
</table>
Everah | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Mon Apr 09, 2007 5:18 pm
by Benjamin
Don't use short tags (<?), change to <?php
Posted: Mon Apr 09, 2007 5:38 pm
by RobertGonzalez
astions nailed it for your I believe. That is like the third or fourth short tags related problem posted here in the last two days. Seems to be turning into an epidemic.
If I could ask, what is this little beauty supposed to do:
Code: Select all
<?php
if(isset($index) != 1)
{
die("Please contact admin.");
} else {}
?>
Posted: Mon Apr 09, 2007 5:44 pm
by quadoc
Thanks for the info. everyone. The code was just an example. Also, when I click on the "Code" button in the post a reply, it doesn't insert the tag for me. It it not working? Could someone check into that.
Posted: Mon Apr 09, 2007 5:49 pm
by Weirdan
Posted: Tue Apr 10, 2007 11:19 am
by quadoc
So is there a way that I can set some switches that will work with the "<?" or do I have to change every occurences of "<?" to "<?php", does anyone know? Thanks...

Posted: Tue Apr 10, 2007 11:22 am
by RobertGonzalez
You can change your php.ini file, but I am almost certain that short tags are deprecated in PHP6, which means at some point you will need to change your code in order to run properly. Now is as good a time as any.