How can I set $sections up so it works outside of the while loop?
while($sections = mysql_fetch_array($query)) {
$section_name = $sections['location'];
$sections[$section_name] = $sections['content'];
echo $sections['main'];
}
$sections['main'] echoes correctly here, but when I run it further down in the code (outside the while loop) it displays nothing. I assume this is something to do with the scope?
I've tried both $sections = array(); and $sections = ''; prior to the loop. Both don't solve the issue. Thanks.