Here's the code; I don't know what the problem is:
foreach($data as $page=>$item)
{
$output.= "<tr><td><a href='".$wgScript."?title=".urlencode($page)."'>";
// Changing this line will change the text that appears in the article link.
$page = str_replace("_"," ",$page);
$output.= $page;
$output.= "</a></td>\n";
foreach($headers as $header)
{
# $header = strtolower($header);
if(isset($item[$header]))
# $output.= "<td>".$item[$header]."</td>\n";
$output.= "<td><a href='".$wgScript."?title=".urlencode($item[$header])."'>"; //.$item[$header]."</a></td>\n";
$item = str_replace("_"," ",$item); #new
// $output.= /*$item[$header].*/"</a></td>\n"; #new
// $output.= "</a></td>\n"; //<-------------this is the line it bitches about but it's commented out! uh...
else
$output.= "<td> </td>\n";
}
$output.= "</tr>\n";
}