Welcome Guest, Not a member yet? Register   Sign In
Controller function with arguments
#1

[eluser]Benjamin Midget[/eluser]
I have a controller with:

function thing($stuff, $id)

but no matter what I put in the URL, I get an error that the arguments are missing.

my URL looks like www.blah.com/section/thing/stuff/123
#2

[eluser]sophistry[/eluser]
do you have any routes defined?

have you checked the data that comes in using the URI class methods like $this->uri->segment(n)

cheers.
#3

[eluser]JasonS[/eluser]
I see nothing wrong with your code. What happens when you remove the arguements?

What error are you getting. What line specifically does it associate itself with?
#4

[eluser]Bl1nk[/eluser]
Ive been looking for a solution of this problem but I found this thread very the same with my problem. I installed new version of codeigniter 1.7.1 with xampp 1.7.2, I dont know if these are compatible.

When I tried this URL:

http://localhost/mostrag/index.php?/most...9156824269

It outputs an error of: Message: Missing argument 1, which I think that my code is correct.

My class looks like this:

class Mostrag extends Controller {

// ...

public function profile($id)
{
// ...
}
}


I hope you can suggest what’s happening in my xampp and codeigniter. Im doing this in Windows Vista.


Thanks.
#5

[eluser]sophistry[/eluser]
two things...

do you have an htaccess file?

what happens if you take out the question mark after index.php?




Theme © iAndrew 2016 - Forum software by © MyBB