First, let me say thanks and hi to Jpadie, Tarwn and all the other PHP Masters that make this the best PHP forum around.
Now, let me get into my question.
My ultimate goal is to build a site and have all the pages loaded into a mysql database except the index.php page. I'm loading them into the database by inserting the html content of the page into a "longtext" data type field. Then what ever link you click on, is performing a sql query to that particular page in the database.
Example: If you click on the "Contact Us" link the select statement says...
select page_name from html_content where page_name = contact us
Well this is working fine and it's very fast like I wanted. here is the problem. If the page that i'm pulling from the data base has php in it, it's not being processed as php.
Is there a way to have this data processed as php then displayed. I've never done this so I don't know if there is a way, or am I spitting into the wind
.
here is a page that I'm calling and it is supposed to just list all the page names out of the database. It works if I copy it to a php page and open it in my browser. but not if I call it from a sql query. All I see is this on the screen...
= $allcategories_columns) { ?>
"); $allcategories_endRow++; } echo(""); }?>
here is the actual page it's pulling
<?php require_once('Connections/testconnect.php'); ?>
<?php
mysql_select_db($database_test, $test);
$query_allcategories = "SELECT * FROM card_catagory";
$allcategories = mysql_query($query_allcategories, $test) or die(mysql_error());
$row_allcategories = mysql_fetch_assoc($allcategories);
$totalRows_allcategories = mysql_num_rows($allcategories);
?>
<table width="713" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="70"><img src="images/bar-small.jpg" width="713" height="8" alt="image header"><br>
<img src="images/headers/categories.jpg" width="713" height="70" align="middle" alt="marketing"></td>
</tr>
<tr>
<td height="27"><img src="images/stripe_bar.jpg" width="713" height="27" alt="postcard templates"></td>
</tr>
<tr>
<td height="375" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
</table>
<table >
<tr>
<?php
$allcategories_endRow = 0;
$allcategories_columns = 3; // number of columns
$allcategories_hloopRow1 = 0; // first row flag
do {
if($allcategories_endRow == 0 && $allcategories_hloopRow1++ != 0) echo "<tr>";
?>
<td height="86"><table width="249" height="77" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="300"><a href="selectthumbs.php?photo_category=<?php echo $row_allcategories['card_catagory_id']; ?>"><?php echo $row_allcategories['card_catagory_desc']; ?></a></td>
</tr>
</table></td>
<?php $allcategories_endRow++;
if($allcategories_endRow >= $allcategories_columns) {
?>
</tr>
<?php
$allcategories_endRow = 0;
}
} while ($row_allcategories = mysql_fetch_assoc($allcategories));
if($allcategories_endRow != 0) {
while ($allcategories_endRow < $allcategories_columns) {
echo("<td> </td>");
$allcategories_endRow++;
}
echo("</tr>");
}?>
</table></td>
</tr>
</table>
<?php
mysql_free_result($allcategories);
?>
Now, let me get into my question.
My ultimate goal is to build a site and have all the pages loaded into a mysql database except the index.php page. I'm loading them into the database by inserting the html content of the page into a "longtext" data type field. Then what ever link you click on, is performing a sql query to that particular page in the database.
Example: If you click on the "Contact Us" link the select statement says...
select page_name from html_content where page_name = contact us
Well this is working fine and it's very fast like I wanted. here is the problem. If the page that i'm pulling from the data base has php in it, it's not being processed as php.
Is there a way to have this data processed as php then displayed. I've never done this so I don't know if there is a way, or am I spitting into the wind
here is a page that I'm calling and it is supposed to just list all the page names out of the database. It works if I copy it to a php page and open it in my browser. but not if I call it from a sql query. All I see is this on the screen...
= $allcategories_columns) { ?>
"); $allcategories_endRow++; } echo(""); }?>
here is the actual page it's pulling
<?php require_once('Connections/testconnect.php'); ?>
<?php
mysql_select_db($database_test, $test);
$query_allcategories = "SELECT * FROM card_catagory";
$allcategories = mysql_query($query_allcategories, $test) or die(mysql_error());
$row_allcategories = mysql_fetch_assoc($allcategories);
$totalRows_allcategories = mysql_num_rows($allcategories);
?>
<table width="713" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="70"><img src="images/bar-small.jpg" width="713" height="8" alt="image header"><br>
<img src="images/headers/categories.jpg" width="713" height="70" align="middle" alt="marketing"></td>
</tr>
<tr>
<td height="27"><img src="images/stripe_bar.jpg" width="713" height="27" alt="postcard templates"></td>
</tr>
<tr>
<td height="375" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
</table>
<table >
<tr>
<?php
$allcategories_endRow = 0;
$allcategories_columns = 3; // number of columns
$allcategories_hloopRow1 = 0; // first row flag
do {
if($allcategories_endRow == 0 && $allcategories_hloopRow1++ != 0) echo "<tr>";
?>
<td height="86"><table width="249" height="77" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="300"><a href="selectthumbs.php?photo_category=<?php echo $row_allcategories['card_catagory_id']; ?>"><?php echo $row_allcategories['card_catagory_desc']; ?></a></td>
</tr>
</table></td>
<?php $allcategories_endRow++;
if($allcategories_endRow >= $allcategories_columns) {
?>
</tr>
<?php
$allcategories_endRow = 0;
}
} while ($row_allcategories = mysql_fetch_assoc($allcategories));
if($allcategories_endRow != 0) {
while ($allcategories_endRow < $allcategories_columns) {
echo("<td> </td>");
$allcategories_endRow++;
}
echo("</tr>");
}?>
</table></td>
</tr>
</table>
<?php
mysql_free_result($allcategories);
?>