CodeIgniter Forums
display method issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: display method issue (/showthread.php?tid=87217)



display method issue - krava - 03-27-2023

Hello
I have following issue. I've created new controller and added index($id) method with the parameter $id, But I receive an 404_error when I try to open the url localhost/subscription/111
This url works correctly localhost/subscription/index/111
When I remove parameter from the method, the method also works well, but I have to use this url localhost/subscription/111 instead of localhost/subscription/index/111
Could you advise how to resolve this issue?
here is my code:
PHP Code:
class Subscription extends ClientsController
{
    public function __construct() {
        parent::__construct();
    }
    public function index$id ) { 
PHP Code:
        echo $id;
    }




RE: display method issue - datamweb - 03-27-2023

Hi,
Share the Config/Routes.php code.


RE: display method issue - krava - 03-27-2023

(03-27-2023, 05:14 AM)datamweb Wrote: Hi,
Share the Config/Routes.php code.
thank you for the assistment, I've  checked the Config/Routes.php and added new route there.