Thanks in advance for any help.
I am trying to figure out how to rewrite dynamic urls created with a simple cms programming I am building. The code outputs the URL with the ID (www.mysite.com/index.php?id=1). I would like to modify the code so that it outputs the title of the row in the db with the id of 1 such as www.mysite.com/home or www.mysite.com/about where about is the title stored in the row of the db with an id of 1.
Here is an example of how the code outputs:
$result = mysql_query("SELECT id, title FROM pages");
while ($row = mysql_fetch_array($result)) {
// Do not list the home page twice
if ($row['id'] != $homeID) {
$pageID = $row['id'];
$pageTitle = $row['title'];
echo "<li><a href='" . BASE_URL . "/index.php?id=$pageID'>$pageTitle</a></li>";
}
I am going off of the CMS tutorial from: http://fwebde.com/web-design/creating-a-php-cms-part-1/
Any help would be greatly appreciated. I have attempted numerous .htaccess rewrites and NONE of them have worked. Please let me know if this is as simple as switching around the MySQL code.