Tuesday, 27 August 2013

Using array from header in another page

Using array from header in another page

Ok so I have an array "$landing" in my header.php, then in my page.php I
include the header.php but for some reason when I call the array in the
page: echo $landing['Name']; it just doesn't work.
this is how the array is being filled up, and calling it in the header
works perfectly.
$landing = array();
while ($row = mysql_fetch_array($result)) {
$str = strtolower($row['Name']);
if ($str == $name) {
$landing = $row;
}
}
What am I doing wrong here? Do I need to make it global somehow or what's
going on?

No comments:

Post a Comment