View Single Post
Old 07-24-2002, 10:18 PM   PM User | #1
Dalsor
New Coder

 
Join Date: Jul 2002
Location: Florida, USA
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Dalsor is an unknown quantity at this point
Include and arrays

Greetings.

Slight problem with pulling data from arrays stored in an included file. If I store the arrays in the same PHP file that is displaying the information, this works fine, but when I store the arrays in a seperate file and include() it, it can't find the data. I'm trying to keep all the arrays in one file by themselves to make changing things easier. Here's what I have come up with.

This is an excerpt from index.php
PHP Code:
<!--
Function: draw_body
Include: none
Purpose: Draw body text
//-->

<?php include('arrays.php'); ?>
<table width="100%" border="0" cellspacing="5" cellpadding="2">
  <tr>
  <td class="body2" height="100">
  <?php
  
for ( $i 0$i <= $warders$i++ )
  {
  echo 
$warArray[$i];
  echo 
"<br>";
  }
  
?>
  </td>
  </tr>
</table>
This is from arrays.php
PHP Code:
<?php
    $warArray
[0] = 'Asandir';
    
$warArray[1] = 'Caellach';
    
$warArray[2] = 'Caldamus';
    
$warArray[3] = 'Drizzt';
    
$warArray[4] = 'Flarn';
    
$warArray[5] = 'Jaryd';
    
$warArray[6] = 'Kale';
    
$warArray[7] = 'Kodel';
    
$warArray[8] = 'Kordac';
    
$warArray[9] = 'Lanth';
    
$warArray[10] = 'Makojin';
    
$warArray[11] = 'Mallagant';
    
$warArray[12] = 'Mica';
    
$warArray[13] = 'Narival';
    
$warArray[14] = 'Navvar';
    
$warArray[15] = 'Phostan';
    
$warArray[16] = 'Rance';
    
$warArray[17] = 'Ransard';
    
$warArray[18] = 'Rylas';

    
$warders count$warArray );
?>
Thanks in advance for any advice.
Dalsor is offline   Reply With Quote