A
allin4466
Guest
Ok, so I am trying to make it so I can add blocks to my pages, and just update a "blocks" table that shows what blocks to show on what pages.. I am trying this, but the include function fails for whatever reason. I only have two blocks in the table right now, it displays the first block fine, then just quits. If i replace the include with echo "test test test" both blocks will show.
Code:
mysql_select_db("$db", $con);
$result = mysql_query("SELECT * FROM blocks where page = '$page'");
while($row = mysql_fetch_array($result))
{
echo "<tr><td class='left_nav_header'>".$row['desc']."</td></tr>"; //header
echo "<tr class='left_nav_content_row'><td class='left_nav_content'>";
$x = $row['location']; // gets block page location
$incfile = "../Blocks/$x"; // declares it as Blocks/location/file.php";
include("$incfile");
echo "</td></tr><tr><td class='left_nav_footer'></td></tr>"; //footer
echo "<tr class= 'spacer'><td>Â*</td></tr>";
}
Code:
mysql_select_db("$db", $con);
$result = mysql_query("SELECT * FROM blocks where page = '$page'");
while($row = mysql_fetch_array($result))
{
echo "<tr><td class='left_nav_header'>".$row['desc']."</td></tr>"; //header
echo "<tr class='left_nav_content_row'><td class='left_nav_content'>";
$x = $row['location']; // gets block page location
$incfile = "../Blocks/$x"; // declares it as Blocks/location/file.php";
include("$incfile");
echo "</td></tr><tr><td class='left_nav_footer'></td></tr>"; //footer
echo "<tr class= 'spacer'><td>Â*</td></tr>";
}