Looks like what you're doing here is encoding the title before it goes into the database!
I would not do it this way. Do not encode data for DB, but encode it as you're looping the results to the page, or even better, add an extra column called slug.
This means the title is Some Clean Title Here
and in the slug column you have some-clean-title-here
, so then you use $row['slug']
.
Then in your link use
<a href="site_root.tld/post/<?=$row['slug']?>"><?=$row['title'];?></a>
Always escape your data with mysql_real_escape_string
and use a function that doesn't just urlencode the slug on db entry, but also creates a sleek, elegant, safely formatted string.
The best form for a slug is a-zA-Z0-9 - _
only.