mod_rewrite how to get title from sql table in url but use

Discuss server installationa nd configuration issues here

Moderators: macek, egami, gesf

ramtindow
New php-forum User
New php-forum User
Posts: 2
Joined: Sat Aug 18, 2012 9:13 am

mod_rewrite how to get title from sql table in url but use

Postby ramtindow » Sat Aug 18, 2012 9:17 am

hello, pleaaase help me!
I have a php file "page.php" witch it gives the variable "id" from the url and shows a record WHERE id=$_GET['id'] .

I want to replace urls like "example.com/books/page.php?id=$id" (where $id can be anything numeric) with sth like "example.com/books/$id/title/"

where title and id are columns of sql table.

I want to know what to write in .htaccess file and how it gets the title from sql and writes it in front of $id in the url.

also I would like to titles Spaces be replaced by Dash sign.


my table is like :

id | title |
1 | an example |

witch then we should be able to use url "example.com/books/1/an-example/" instead of "example.com/books/page.php?id=1" .

Thanks a lot!

Return to “Server installation and configuration”

Who is online

Users browsing this forum: No registered users and 0 guests

cron