What causes this “Missing argument 2 for Categories::posts()” error? |
I am working on a small blogging application. There is a clear separation between its back-end and its front-end.
The back-end is an [b]API[/b], made with Codeigniter 3, that spits out pages, posts, pagination etc. In this API, the [b]Categories[/b] controller displays, among others, [i]post by category[/i]: Code: public function posts($path, $category_id) { The code above has a bug who's cause I can not find. The error message the application throws is: Code: Missing argument 2 for Categories::posts() Where is my mistake?
it's telling you that it is not getting the $category_id
If you are setting it then just initialize it like so. PHP Code: public function posts($path, $category_id = 0) Otherwise you are getting an empty $category_id Do a var_dump on it. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
The problem is not in Categories::posts()
The problem is how you are calling it. Show us the code where you call posts. |
Welcome Guest, Not a member yet? Register Sign In |