Reputation: 9
I have a model with two functions, like this:
<?php
class FotoModel extends CI_Model
{
function __construct()
{
parent::__construct();
}
function getFotosByCat($cat)
{
$this->load->helper("file");
switch($cat)
{
case "bloemen" : return get_filenames("/images/foto/bloemen/");
case "dieren" : return get_filenames("/images/foto/dieren/");
case "andere" : return get_filenames("/images/foto/andere/");
}
}
public function getFotoLinksByCat($cat)
{
$fileNames = getFotosByCat($cat);
//i do stuff with $fileNames and provide a return statment..
}
}
?>
I load the model in my controller and tested the second method with some static data for $fileNames and everything works fine. Only when I make a call to the first function (the one with the switch/case statement) from the second (as seen in the code-example) I get an error.
And the thing is I don't even get to see what kind of error. It is because of testing and trying that I know the error MUST be in the first function. Anyone that can help me to solve this one?
Upvotes: 1
Views: 105
Reputation: 314
I noticed in your switch you haven't used any break;'s
(im sorry im a SO n00b and I can't for the life of me figure out inline code span..)
Upvotes: -1