⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Fetch id from url



abhishek
  • profile picture
  • Member

Posted 09 May 2013 - 13:48 PM

Hi All

 

I want to fetch id from the url.

 

URL:- http://localhost/projects/PortalGrocery/development/admin/qareports/index/edit/3

I have tried:-

        $update_url = $_SERVER['REQUEST_URI'];
        $path = parse_url($update_url, PHP_URL_PATH);
        $pathComponents = explode("/", trim($path, "/"));
        $ID = $pathComponents[7];

 

It is working fine but when i upload my project on live site, i have  to change the component number everytime and in every controller as there is difference in no. of components.

So, I want to know if there is any other method to fetch to do so..?

 

 

Thanks in advance.


sachin vairagi
  • profile picture
  • Member

Posted 09 May 2013 - 13:52 PM

abhishek from ideal???


davidoster
  • profile picture
  • Member

Posted 09 May 2013 - 14:58 PM

it is answered here: /topic/1659-displaying-record-name-while-editing/#entry7286


abhishek
  • profile picture
  • Member

Posted 10 May 2013 - 05:04 AM

@davidoster,

I dint get how will i fetch id from the  answer mentioned in

http://www.grocerycr...ting/#entry7286

 

I just  want to fetch id from the url

My url looks like:

http://localhost/projects/PortalGrocery/development/admin/projects/home/edit/27


davidoster
  • profile picture
  • Member

Posted 10 May 2013 - 05:28 AM

$id = $this->uri->segment(3);