Page 1 of 1

Trying to include a file.

Posted: Thu Apr 23, 2009 3:12 pm
by tymlls05
This was previously working with include_once. The file I am trying to include creates a list of arrays using a different server.

this.php:

Code: Select all

 
<?
 
$s_time     = "3esh";
$server_name    = "big comp";
$npc_count      = "5";
 
$online_name[]  = "frank";
 
$online_name[]  = "frank2";
 
$online_name[]  = "frank3";
 
$online_name[]  = "frank4";
?>
 
My script calling the file

Code: Select all

<? include_once('this.php')?>
 
<? echo $s_time;?>
 

It just returns nothing at all. just blank.

Re: Trying to include a file.

Posted: Thu Apr 23, 2009 3:38 pm
by greyhoundcode
When you say, "The file I am trying to include creates a list of arrays using a different server," do you mean that it is actually on a different box? Like your script calling the file is on http://www.abc.com and the file you are trying to include is on http://www.xyz.com?

Also, is support for short tags enabled?

Re: Trying to include a file.

Posted: Thu Apr 23, 2009 4:16 pm
by tymlls05
Here, I removed the include and just pasted the file into my script to remove the possibility of include issues.

Code: Select all

<?
 
// include('http://74.196.23.160:2593/newstat.php'); 
 
$s_time     = "2009/04/23 17:16:10";
 
$server_name    = "Dark August";
 
$npc_count      = "16938";
 
$item_count     = "78004";
 
$guild_count    = "8";
 
$client_count   = "3";
 
$memory_usage   = "86300";
 
$admin_email    = "tyler@aimelssmedia.com"; $online_name[]="Malakai"; $online_account[]= "malakai"; $online_name[]="Zato"; $online_account[]= "pasho";
 
 
foreach ($online_account as $v){
echo $v;
}
foreach($online_name as $v) {
echo $v
}
 
 ?>
 
 
Why will that code not echo or print?

Re: Trying to include a file.

Posted: Thu Apr 30, 2009 2:39 pm
by greyhoundcode
Problems flagged when I tried your code on my setup were your use of short PHP tags and a missing semi-colon: if you sort those issues then you should find that your echoes work.

Re: Trying to include a file.

Posted: Thu Apr 30, 2009 11:08 pm
by susrisha

Code: Select all

 
foreach($online_name as $v) {
echo $v; //you missed a ; here in your code
}