I'm missing something really simple here!
index.php requires connect.php:
<?php require_once('scripts/connect.php'); ?>
connect.php collects some data from a DB and places it in an array:
<? $query = "SELECT id,termine FROM tbl_standorte";
$result = mysql_query($query) or die ("no query");
$result_array = array();
while($row = mysql_fetch_assoc($result)){$termine_array[] = $row;} ?>
index.php then requires sub.php:
<? require('sub.php');?>
And sub.php contains the following function which is then called by passing a variable to $value:
<? function searchSubArray($value) {
foreach ($termine_array as $subarray){
if (isset($subarray['id']) && $subarray['id'] == $value)
echo 'Result:'.str_replace(';','<br>',$subarray['termine']);
}
} ?>
sub.php then calls the function <p><? searchSubArray(133);?></p>
However, I get no output! What am I missing?