How to detect Post Id from Slug

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shafiq2626
Forum Commoner
Posts: 88
Joined: Wed Mar 04, 2009 1:54 am
Location: Lahore
Contact:

How to detect Post Id from Slug

Post by shafiq2626 »

Hi to all.
I have a data in news panel and also I saved slug against this value.
My link make like this.

http://ilm.com.pk/portal/events/this-is ... ther-event

So How I can detect Id from slug to display data.

My Query is like this

Code: Select all

$sql = $this->MMdbobj->query("SELECT * FROM  tbl_news where news_id=$_REQUEST[event_id]");
				$sendcontents = $this->MMdbobj->fetch_assoc();
How will I Get Event Id from Slug /this-is-new-another-event
Please help.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to detect Post Id from Slug

Post by requinix »

What values do you have in $_REQUEST?
Post Reply