I want to write friendly urls by changing fullnews.php?id=123
to something like
fullnews.php/123/This-is-the-Headline or fullnews.php/This-is-the-Headline-123
"This is the Headline" is the headline of the news item as selected from the database,
id is the id selected from the database, I want to attach the id to the headline in url
so as to make it unique in case of similar headlines.
The db query code is something like this:
$sel=mysql_query("select id, headline from newstable");
while($row=mysql_fetch_array($sel))
{
$id=$row['id'];
$headline=$row['headline'];
echo "<a href='fullnews.php?id=$id'>$headline</a>";
}
What htacess code should I use and how do I re-write the hyperlink "<a href='fullnews.php?id=$id'>$headline</a>"
to achieve the goal.
Thanks.