Welcome Guest, Not a member yet? Register   Sign In
Nested data arrays in CI views - howto access?
#1

[eluser]mjstenbe[/eluser]
Im having major difficulties in prosessing nested MySQL data in my views. See sample data below.

Im pulling a set of RSS data from MySQL db to be processed and displayed for the user. The MySQL data is fetched using

Code:
function get_news($offset=5) {

        $query = $this->db->query("SELECT * FROM News ORDER BY pubDate DESC LIMIT $offset");
    return $query->result_array();        
    }

I pass the data to a view, using:

Code:
$query = $this->db_model->get_news();
$this->load->view('news', $query);

I cannot, however, seem to access to this data from my view in any means. I tried looping and printing out the $query-arrays, even accessing them through global variables but nope. Could someone point me to the right directions here, please? What am I doing wrong, or did I miss something obvious Smile


Sample data clip:
Code:
Array
(
    [0] => Array
        (
            [Title] => Ympäristömerkillä ei vaikutusta tuotehintaan
            [Description] => Ympäristömerkillä ei juuri ole vaikutusta tuotteiden hintoihin. Pohjois-Suomen aluehallintoviraston tekemä selvitys osoittaa, että ympäristöystävällinen valinta on joissakin tapauksissa jopa halvempi kuin vähemmän ympäristöystävällinen.
            [pubDate] => 2010-09-08 14:08:27
            [Link] => http://yle.fi/alueet/oulu/2010/09/ymparistomerkilla_ei_vaikutusta_tuotehintaan_1964381.html?origin=rss
            [Source] => Yle uutiset
            [id] => 1908
            [category] => Oulu
            [channel] => YLE Uutiset | Tuoreimmat uutiset
        )

    [1] => Array
        (
            [Title] => Tutkijoiden työnkuva hukassa rokoteuutisissa
            [Description] => Hyvin harvoin tieteelle annetaan niin paljon palstatilaa kuin viime viikkoina. En usko että suuri yleisö on kuitenkaan päässyt viisastumaan näiden uutisten avulla. Lähinnä kirjoitukset ja keskustelut ovat maalanneet sangen erikoista kuvaa tieteenteki
            [pubDate] => 2010-09-08 14:04:17
            [Link] => http://yle.fi/uutiset/kotimaa/2010/09/tutkijoiden_tyonkuva_hukassa_rokoteuutisissa_1964415.html?origin=rss
            [Source] => Yle uutiset
            [id] => 1909
            [category] => Kotimaa
            [channel] => YLE Uutiset | Tuoreimmat uutiset
        )

Is there any way to print out all the variable data passed to a specific view? This would be very useful?

Any help would be highly appreciated.

Thanks,
Mika


Messages In This Thread
Nested data arrays in CI views - howto access? - by El Forum - 09-08-2010, 05:50 AM
Nested data arrays in CI views - howto access? - by El Forum - 09-08-2010, 05:55 AM
Nested data arrays in CI views - howto access? - by El Forum - 09-08-2010, 09:36 AM
Nested data arrays in CI views - howto access? - by El Forum - 09-09-2010, 12:27 AM
Nested data arrays in CI views - howto access? - by El Forum - 09-09-2010, 12:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB