I have a question...How to pass a variable from a function to another in php.. My first function:
public function get($obj_id)
{
    $exclude = array();
    $query = $this->db->query("SELECT
                                a.id as id_article ,
                                a.title,
                                a.content,
                                a.date,
                                a.views,
                                a.smallimage,
                                a.largeimage,
                                tin.id,
                                t.id,
                                group_concat(t.name) as tags,
                                group_concat(t.id) as id_tag
                                from tags_in_news tin
                                inner join articles a on a.id = tin.news_id
                                inner join tags t on t.id = tin.tag_id
                                and a.id = $obj_id
                                group by a.id");
if ($query->num_rows()>0) 
{
    foreach ($query->result() as $cr) 
    {
        array_push($exclude,$cr->id_article);
        $newsIds = implode(',',array_values($exclude));
    }
}
else
{
    $newsIds = 0;
}
    echo "<pre>"; print_r($newsIds); echo "</pre>"; 
return $query->row_array();
}
and the second function:
public function getLastArticles()
{
    $this->load->database();
    $last_articles = $this->db->query("SELECT
                                * FROM articles WHERE id NOT IN (".($newsIds).")
                                 ORDER BY date desc LIMIT 3");
    if ($last_articles->num_rows())
    {
        $last_articles = $last_articles->result_array();
    }
    else
    {
        $last_articles = NULL;
    }
    return $last_articles;
}
When I write print_r($newsIds) I get correct id but whnen I want to using in a second method the error is Undefined variable: newsIds help me please..Thx
