Welcome Guest, Not a member yet? Register   Sign In
$this in a condition
#1

[eluser]TDSPower[/eluser]
Hello CI developpers,

I come again on this board to ask you some help.

Here is my model :

Code:
...

        function getNews($cat){
            if($cat != "0")
            {
                $this->db->where('id_cat',$cat);
                $output['titre_page'] = $this->getNomCat($cat);
            }
            else
            {
                $output['titre_page'] = 'Toutes les news';
            }
                   ...
               }

...

        function getNomCat($idcat){
                $query = $this->db->query('SELECT nom_cat FROM news_categories WHERE id='.$idcat.' LIMIT 1');
                $row = $query->row();
                return $row->nom_cat;
        }
    }
...

The line $output['titre_page'] = $this->getNomCat($cat); createx a php error (Trying to get property of non-object) if the parameter $cat is not egual to 0 (And doesn't launch this line).

What could be the solution ? I can put a @ behind the line but it is too simple Smile

Thanks,

François JAGUELIN


Messages In This Thread
$this in a condition - by El Forum - 01-03-2008, 03:45 AM
$this in a condition - by El Forum - 01-03-2008, 03:58 AM
$this in a condition - by El Forum - 01-03-2008, 04:01 AM
$this in a condition - by El Forum - 01-03-2008, 04:15 AM
$this in a condition - by El Forum - 01-03-2008, 04:24 AM
$this in a condition - by El Forum - 01-03-2008, 04:51 AM
$this in a condition - by El Forum - 01-03-2008, 05:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB