Welcome Guest, Not a member yet? Register   Sign In
query big problem
#20

[eluser]polish[/eluser]
I have the solution. Maybe it isn't optiumum but he is working ok! I created a new view com_news who listing Me the only one news and the view com_loop who loop Me all comments for this newsSmile!

This is the working controller function:

Code:
function show()
    {
    $this->load->model('Comments');
    $this->load->model('News');
    $news_id = $this->uri->segment(3);
    IF(isset($news_id) and is_numeric($news_id))
        {
        $query = $this->News->news_for_com($news_id);
        $query1 = $this->Comments->get_comments_for_news($news_id);
        $content = '';
        if ($query->num_rows() == 1)
            {
            foreach($query->result() as $item)
                    {
                    $content .= $this->load->view('com/com_news', $item, True);
                    }
            }
        if ($query1->num_rows() > 0)
            {
            foreach($query1->result() as $item)
                    {
                    $content .= $this->load->view('com/com_loop', $item, True);
                    }
            }
        else
            {
                $content = '<h1><center>No Comments</center></h1>';
            }
        }
    else
        {
        $this->response['content'] = '<h1><center>Bad Link</center></h1>';
        }
        $this->response['content'] = $content;
    $this->load->view('index', $this->response);
    }


The topic is SOLVED!!!


Messages In This Thread
query big problem - by El Forum - 04-24-2009, 03:45 AM
query big problem - by El Forum - 04-24-2009, 04:18 AM
query big problem - by El Forum - 04-24-2009, 04:22 AM
query big problem - by El Forum - 04-24-2009, 04:33 AM
query big problem - by El Forum - 04-24-2009, 04:34 AM
query big problem - by El Forum - 04-24-2009, 04:49 AM
query big problem - by El Forum - 04-24-2009, 04:54 AM
query big problem - by El Forum - 04-24-2009, 08:48 AM
query big problem - by El Forum - 04-24-2009, 11:57 AM
query big problem - by El Forum - 04-25-2009, 12:44 AM
query big problem - by El Forum - 04-25-2009, 02:32 AM
query big problem - by El Forum - 04-26-2009, 03:35 AM
query big problem - by El Forum - 04-26-2009, 04:53 AM
query big problem - by El Forum - 04-26-2009, 05:09 AM
query big problem - by El Forum - 04-27-2009, 12:46 AM
query big problem - by El Forum - 04-27-2009, 01:04 AM
query big problem - by El Forum - 04-27-2009, 05:54 AM
query big problem - by El Forum - 04-27-2009, 06:16 AM
query big problem - by El Forum - 04-27-2009, 01:04 PM
query big problem - by El Forum - 04-28-2009, 06:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB