[eluser]no_Ob[/eluser]
Hi there
I have got a very annoying problem which is looks like quite simple,but I can't figure it out.
I would like to choose the loaded view according to the database results.
Controller:
Code:
class Categories extends Controller {
function index()
{
parent::Controller();
$this->load->view('index');
$this->load->view('partial/home_view');
$this->load->view('index2');
}
function choice($platform,$what)
{
parent::Controller();
$data['platform'] = $platform;
$data['what'] = $what;
$this->load->model('shopmodel');
$result['query'] = $this->shopmodel->selectkonzol($data);
$data[$platform] = 'T';
$this->load->view('index',$data);
if(!empty($result))
{
$this->load->view('products/games',$result);
}
else
{
$this->load->view('products/noproduct',$database);
}
$this->load->view('index2');
}
}
Model
Code:
class Shopmodel extends Model {
function index()
{
// Call the Model constructor
parent::Model();
}
function selectkonzol($data)
{
$platform = $data['platform'];
$what = $data['what'];
if($what=="games")
{
$query = "SELECT * FROM `games` WHERE `platform`='$platform'";
}
else
{
$query = "SELECT * FROM `products` WHERE `platform`='$platform' and 'productcat'='$what'";
}
$result=$this->db->query($query);
return $result->result();
}
}
If I have no results, it doesnt load the other view
Why is this happening?