• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[DONE] Passing arguments to controller.

Maybe this is a very basic question but i can´t find information for this.

How i show a 404 error when i have done a controller that receive arguments but if you dont send arguments, how to show the 404?


www.myexample.com/user/58 -> argument 58

www.myexample.com/user -> no argument..

funcion User($id)
if (isset($id)){
//bla bla search the info for the id
} else {

i want to show_404() when there are no arguments but codeigniter says:

Argument is missing...

What i can do?? Excuse me, maybe this is a very very basic question, i dont found nothing about this in the guide..

Really thanks codeigniter community!!

Sorry if my english is not good.



sorry my own error.

This form for correct this " stupid " mistake is :

when declaring function:

function User($user = ''){


Writting '' prevent that.

Excuse me again. Thanks.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.