Anurag Garg
Anurag Garg

Reputation: 21

Codeigniter : i need to remove id from my url and need to show the name of that event

I have an url like this

www.domain.com/controller/functionName/event_id

but i need to do this like:

www.domain.com/controller/functionName/event_name

I need to show event name in place of ID i need to show event name but i want event id in next page so that i can proceed with and can show right event detail.

i am new in Codeigniter Can someone explain in simple manner how to pass these parameters to the web server while id is hidden in the url ?

I found some solution for this but i am not able to implement that...Kindly help me for this

Upvotes: 0

Views: 1204

Answers (1)

mariobgr
mariobgr

Reputation: 2201

function name($event_name) {

  $event_id =  $this->model_name->getEventByName($event_name);

  ....

}

in the model, the query should be something like

SELECT event_id FROM events WHERE name = '$event_name';

With the proper escaping of the parameter.

Upvotes: 2

Related Questions