Home › Forums › Back End › PHP passing requested post id and title in url but not showing id › Reply To: PHP passing requested post id and title in url but not showing id
You would have to provide more details about the CMS you are using.
As you have stated, ID based lookups are recommend, because:
1) numeric comparisons are faster than string comparisons
2) the ID field is almost certainly indexed in the database, which will make it much faster to lookup
Your CMS almost certainly provides a way to get the post ID without extra work, by way of a function or global(ish) variable.
For example, in WordPress you can retrieve the post ID by using a function, called get_the_ID. You could assign it as such:
$id = get_the_ID();
And then query the database to your liking.