I'm working on a website for a gaming group I'm on staff on, rewriting all the code into more user friendly functions. The problem is, I want to define a function that takes an three dimensional array of news items, defined as a $news[integer][newsitem], and pass it to foreach to display each item of news in the array passed to the function. Here's the function code:
function thiswillchange($array)
{
?>
<table border="0" cellpadding="1" cellspacing="0">
<?
foreach($array as $value)
{
?>
<tr>
<td colspan="2">
<a name='<? echo $value["newsid"];
echo "'";
?>
</a><font class="SilverTextBold">File ID: </font><font class="OrangeText"><? echo $value["newsid"];?></font><br>
</td>
</tr>
<tr>
<td><nobr> <img SRC="Images/square.gif" WIDTH="6" HEIGHT="6"> </nobr></td>
<td width="100%"><font class="NewsTitle"><? echo stripslashes($value["newsheadline"]);?></font></td>
</tr>
<tr>
<td></td>
<td width="100%"><? echo date("m/j/Y : h:i:s a", $value["time"]);?> :
<?
echo "<a href='gamers/playerinfo.php?playerquery=";
echo $value["name"];
echo "'>";
echo $value["name"];
echo "</a>";
?></a></td>
</tr>
<tr>
<td colspan="2"><br></td>
</tr>
<tr>
<td colspan="2">
<?
echo stripslashes($value["newscontent"];?>
</td>
</tr>
<tr>
<td colspan="2"><br><br><br></td>
</tr>
<?
}
?>
</table>
<?
return 0;
}
When I upload the code, and include the function, not even calling it, the page does not display, and the webserver gives an error. Is there something fundamentally wrong with what I'm doing?
Brandon Ewing