Generating Dynamic Pages from MySQL DB
Posted: Tue Jul 29, 2008 12:13 am
Sorry if I should've put this in the Databases forum, sees like my problem is with php, though.
I have a table with all of the pages and their content already created (fields for URL, Title, Meta, H1, Body, etc.), and I'm able to list all of the records via an array and create a link to the dynamic pages I want to go to:
This creates a nice home page with links like this:
Of course, there is no Page-One.html, etc., and I don't want to have to create them; the whole point is to have them dynamically generated when the DB is altered (via phpMyAdmin). So, how do I go about telling php to generate these pages? Is there a function I'm missing?
I've been looking for this for quite some time, and I'm not even sure it's a php issue. Recent search results have me thinking this is best done via mod_rewrite, but, knowing next to nothing about .htaccess, I'd rather do it in php, if possible. The whole reason I'm not using an off the shelf CMS is because I want to keep it simple so I can fix problems down the road, and php is about all I know when it comes to server-side stuff.
Anyway, any help would be greatly appreciated. TIA.
I have a table with all of the pages and their content already created (fields for URL, Title, Meta, H1, Body, etc.), and I'm able to list all of the records via an array and create a link to the dynamic pages I want to go to:
Code: Select all
while($row = mysql_fetch_array($result)){
$urlstring = str_replace(" ","-",$row['parent']);
echo "<a href=\"" . $urlstring . ".html\">" . $row['parent'] . "</a><br />";
}Code: Select all
<a href="Page-One.html">Page One</a>
<a href="Page-Two.html">Page Two</a>
<a href="Page-Three.html">Page Three</a>I've been looking for this for quite some time, and I'm not even sure it's a php issue. Recent search results have me thinking this is best done via mod_rewrite, but, knowing next to nothing about .htaccess, I'd rather do it in php, if possible. The whole reason I'm not using an off the shelf CMS is because I want to keep it simple so I can fix problems down the road, and php is about all I know when it comes to server-side stuff.
Anyway, any help would be greatly appreciated. TIA.