[eluser]boltsabre[/eluser]
Quote:public function cats($post_id = null)
This is dangerous, your ID should NEVER be null... if by some chance it is then your DB query will fail and throw a SQL error - not good!
Best to handle it in the controller, and make sure it is set before calling your model function. If it's a post value, in your validation calls, just make sure 'required' is set, and bam, you form will only ever pass validation if it is set, and you'll only ever call your model after validation has passe. Problem solved!
(mind you, your validation checks would also want to check that it's a number, and above 0!)