Here's the essential code where I wish to include a file twice (actually, I want to include two different files that are nearly clones of one another -- I get the same results trying to include these two files in any combination):
Code: Select all
<hr />
<?php
include ('headline_news.php');
?>
<hr />
<?php
include ('headline_news.php');
?>
<hr />Now here's the code for the included file (and I feel the problem must be in here someplace):
Code: Select all
<?php
$configfile = "news_config.php";
include $configfile;
//=========================================
// FUNCTION: ROW COLOR
//=========================================
function row_color($i, $nrowcolor1, $nrowcolor2) {
$bgcolor1 = $nrowcolor1;
$bgcolor2 = $nrowcolor2;
if ( ($i % 2) == 0 ) {
return $bgcolor1;
} else {
return $bgcolor2;
}
}// END ROW COLOR FUNCTION
echo '<table width="'.$ntable.'" border="'.$nborder.'" cellspacing="'.$ncellspacing.'" cellpadding="'.$ncellpadding.'">'."\n";
$results = @ mysql_query("SELECT * FROM $table WHERE type=1 ORDER BY post_date DESC",$db);
if ($results) {
$i=0;
while ($therow = mysql_fetch_array($results)) {
$color = row_color($i, $nrowcolor1, $nrowcolor2);
$id = $therow["id"];
$post_date = date("m/d", $therow["post_date"]);
$title = stripslashes($therow["title"]);
$shortver = stripslashes($therow["shortver"]);
$longver = stripslashes($therow["longver"]);
echo '
<tr valign="top" bgcolor="'. $color .'">
<td width="1%" class="'.$ndate.'">'.$post_date.'</td>
<td class="'.$nitem.'"><b>'.$title.': </b>'.$shortver;
if (($longver)!="") {
echo ' <a class="'.$nlink.'" href="news-events_single.php?id='.$id.'">'.$nmorelink.'</a>';
}
echo '</td></tr>'."\n";
$i++;
}
} else {
echo '<tr><td class="'.$nnone.'">'.$nnoposts.'</td></tr>';
}
echo "</table>\n";
?>